lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Hello, long time lurker first time poster

There seem to be a lot of developers out there using Lua as a configuration/extension scripting language for use in realtime applications like games.  We've been evaluating a bunch of languages and Lua has been beating all of them in terms of size, simplicity and execution speed.

In a production environment no language could ever be completely sufficient 'out of the box', and thus the language will need to be manipulated in possibly significant ways.  Examples of these sorts of changes:

* Extending the language syntax for non-programmers (who may be in love with Python's whitespace behavior)
* Seperating LuaNumber into ints/floats for range/performance reasons
* Extending the language syntax for C/C++ programmers (who may be very deeply attached to +=/++/!=)
* Adding automatic support for index-based "string identifiers" (used to localize strings, refer to specific animations, etc)
* Adding compile-time expansion of known types (so rather than a table search for a known interface function you'd inject a constant offset into a function array)
* Adding compile-time replacement of enumerations/flags known in the C/C++ codebase
* Adding a specific allocation/management pattern for single-frame temporaries (like intermediate results in vector math calculations)

The act of extending lua to a particular "lua+" specific to an application or environment can happen in a bunch of ways and seems to be vital to managing the interaction between script and the rest of the application.  I suspect most of this is done by directly manipulating the language internals.  This approach gives you the most flexibility but ties you pretty tightly to a specific distribution (which is not a huge problem in a short term production environment).  There are some interesting tools like MetaLua that allow you to "script" your language extensions, or you can just pre-process the lua script with another lua script before compilation (there are some good examples on the wiki talking about this).

Does anyone have information they could share about their adventures extending the language?