1. I input the following into my wow lua addon and got the following message(line 1) attempt to index global 'mt' (a nil value) I tried to add local before function mt.__add (a,b) on line 1 and i got this message '(' expected near '.' and now i'm out of ideas. Also if someone could give me an example of how meta tables are being used and what can be done with them I'm having a hard time putting 1 and 2 together with this so much to take in 0.o

    function mt.__add (a,b) local result result = setmetatable({},mt) a = {"Alpha", "Beta", "Gamma"} for i=1, #a do table.insert(result,a[i]) end b = {"Delta", "Epsilon", "Zeta"} for i=1, #b do table.insert(result,a[i]) end return result end

    addtest = a + b print(#addtest)

    EDIT: sry for the messed up code/post

  2. I input the following into my wow lua addon and got the following message(line 1) attempt to index global 'mt' (a nil value) I tried to add local before function mt.__add (a,b) on line 1 and i got this message '(' expected near '.' and now i'm out of ideas. Also if someone could give me an example of how meta tables are being used and what can be done with them I'm having a hard time putting 1 and 2 together with this so much to take in 0.o

    function mt.__add (a,b) local result result = setmetatable({},mt) a = {"Alpha", "Beta", "Gamma"} for i=1, #a do table.insert(result,a[i]) end b = {"Delta", "Epsilon", "Zeta"} for i=1, #b do table.insert(result,a[i]) end return result end

    addtest = a + b print(#addtest)

    EDIT: sry for the messed up code/post

    'mt' must be a valid table before you try to add a function declaration to it. Before the function mt.__add line:

    local mt = {}

  3. oh that makes sense =D ty, gonna try it now updating later to see if this fixed it