Log In  


I'm trying to do something like this:

thing = {}

for an amount of times do
add(thing, {a=5,b=6,c=self.a+self.b})
end

the "self" part isn't working

also in the context of the code, the name of "thing" and the values of "a" and "b" are dynamically changing

cheers for your time : )



you can't reference a table if it doesn't exist yet. you just have to break up your code into multiple statements, like this

local t = {
  a = 5,
  b = 6
}

t.c = t.a + t.b

It's not ideal but I think I can work with that, thanks mate



[Please log in to post a comment]