Sunday, December 25, 2005

My other favourite scripting language - Lua

Scripting languages like Tcl/Perl/Python/Python can be embedded into a big program written in a traditional language or like extended by writing glue code to existing libraries written in traditional languages. The latter is definitely much easier, especially with a generic tool like SWIG or a specific one like Pyrex. Most Python experts recommend extending rather than embedding.

However, there are times when embedding is more useful. Also, in many commercial settings, it's sometimes impossible to convince management to write the program in a high level language like python. It's far easier to sneak in, I mean embed ;-), a language into a big C/Java program or framework. A language ideally suited for this is lua, for several reasons. The winning points in personal opinion are (in no particular order):

  • Simple API for embedding.
  • Language is quite small.
  • Minimal external dependencies.
Of course, all embedding scenarios will also require extending because the embedded script needs to hook back into the embedding code.

No comments: