Archive for October 12th, 2008

Oct 12 2008

Adding Lua

Published by under Code

I spent the afternoon adding Lua to my code.  It only took about an hour to get the Lua library compiling and running.  The rest of the time was setting up the various hooks to make the scripting language actually functional.  I did not have time to add an interactive parser, that is on my list of things to do.

I have used Lua on previous games and never been that happy with it.  It tends to run slowly and require more memory than you would expect.  Also, most people tend to use it during development by reading in text files and doing on demand parsing.  This scares me since I prefer doing type checking and variable checking at a compile time…one typo and suddenly your run-time can blow up.  In some games, I have made the memory allocator throw an assertion if someone tried to allocate a var, string, etc. that was not seen before.  This seems to stop the typo problem, assuming that the game (and testers) have coverage over every script.

Continue Reading »

No responses yet