games
pages
posts

iconLua

2009-04-22

Looked a bit at Lua lately, as tinypy doesn't really seem to carry on (yet) and so is a bit risky to use for anything.
Good points about Lua I've seen at first glance: Bad points: The global variables are a kinda big issue, makes it very hard to use scripts in a good way if you have many of them. But of course nothing stops you from sticking a "local" before every use of a variable - which would negates the "human readable" part in the good points though. Oh well.

Update

I figured out a rather easy way around the global variables problem. The answer is lua_setfenv. Basically it means in C code I set a new environment for each Lua module. Then the Lua code can use global variables but they are only global to this module. Variables in other modules can be accessed simply by preceding them with the module object. So, this is quite nice.