I've been working on procedural map generation in TIC-80 (ambitious I know...) And I've hit a problem that's got me stumped.
I need to write a function that builds a table of attributes for an object, that I can call later...
From there I can create objects like so:
The problem is when I try referring to my objects:
If obj1.attribute==blah then
do awesome stuffs
I always get an error saying
"Attempting to index a nil value"
I understand what this means... Somewhere in the deep recesses of my code, my table of attributes is getting lost. And so obj1 is being assigned no value.
I've been googling this problem... It could happen if I typed
By leaving off the parentheses I'm assigning the entire function to the variable object. I've double checked and this isn't my problem.
Anyone know what I'm doing wrong??