Page 1 of 1

load.lua questions

Posted: Wed May 12, 2010 5:19 am
by WillShattuck
Hi DG,

I finally got TE4 downloaded tonight. What's funny is I started going through the code before I even played the game. heh.

In figuring out how the ToME4 module loads (so I can make a Template Module), I noticed that body parts are loaded directly in load.lua instead of being called by a loadDefinition. Is there a reason some are coded directly in load.lua and others are loaded?

dofile - is the precompiling certain Lua code files ahead of time so it doesn't have to interpret them as they come up?

loadDefinition - this is loading variables into memory so they can be more easily referenced?

I do admit that I know nothing about Lua (well, next to nothing. Tonight I read from the Lua manual), but am interested.

Thanks.

[NOTE: this may not be in the right forum. Feel free to move it if needed.]

Re: load.lua questions

Posted: Wed May 12, 2010 8:45 am
by darkgod
Body parts:
It wasnt big enough to justify its own file mainly ;)

dofile: It just runs the given lua file, doing whatever the file does

loadDefinition: classes that have this method use it like dofile but in a specialized way, this allows the called file to have access to special functions to define new stuff, depending on the class used.

A template module is a good idea, I wanted to do one but I keep stalling it to work on the ToME module :)