So I initially had a table as follows
scenes = {
[1] = {
preDraw = function(self)
--stuff that references self
end
};
[2] = {
postDraw = function(self)
--stuff that references self
end
};
}
and it worked fine, but I decided to use strings instead of numbers, so imagine it as
scenes = {
[“A”] = {
};
[“B”] = {
}
}
with the same type of references. Now, I have a variable “activeScene” which in the first block was a number, and in the second is a string. When I call a function using the number form ( scenes[activeScene]:preDraw() ) it works fine, but when I do the same with the string form, it breaks. Does anybody have any idea why this is the case, and any suggestions? I would prefer to go with strings if possible, but if there is no solution I can work with numbers. Thanks!