Advice on making a level editor

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: Advice on making a level editor

Post 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:

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
  baby:hurt(me)
end
User avatar
Lugen
Prole
Posts: 24
Joined: Mon Nov 10, 2014 8:36 am
Location: Sweden

Re: Advice on making a level editor

Post 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.
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests