Page 3 of 3

Re: Advice on making a level editor

Posted: Sat Jun 20, 2015 6:47 pm
by s-ol
Lugen wrote:
S0lll0s wrote:
Lugen wrote:
EDIT: Looked again at your example code and realized "img" is both userdata and a table key. Can you actually use that as a field?
If I understand your question correctly, yes, you can use userdata as table keys.
I had no idea. That's really interesting.
You can use functions aswell. All Lua types are created equal :crazy:

Re: Advice on making a level editor

Posted: Sat Jun 20, 2015 8:42 pm
by Lugen
S0lll0s wrote: You can use functions aswell. All Lua types are created equal :crazy:
And it works! Now I can fetch the necessary userdata for my entities when loading the level again, and when saving I only need to determine by the type of the userdata which table to look at for the metadata. I can assign the userdata to my components directly as usual.
So now it seems I can move forward.