Scripting Languages

I am looking for a good scripting language to link to my program. I am looking for 2 important attributes:

  • Scripting language should be hard linked into the executable (not requiring 3rd party installations). This is important to me to simplify distribution.
  • Scripting should allow some run-time debugging option (When running a script inside my program I would like to easily run it inside a debugger while it is running in the context of my program)

Can python,lua or some other language supply me with this?

Answers


Both Lua and Python can provide the features you mention, so choosing one of them will depend on other criteria.

Lua is a lighter weight solution, it will have a much smaller disk footprint and likely a smaller memory overhead than Python too. For some uses it may be faster. Python has a much richer standard library, more mature third party libraries and a more expressive language.

Both have been embedded into major applications. Python can be found in Blender, OpenOffice and Civilization 4. Lua can be found in World of Warcraft and Adobe Lightroom. I'd recommend looking at a few tutorials for each and the facilities available to embed them in your application and just choose the one that fits your brain best.


Lua is designed for this:


Typically, Lua is the better choice for embedding into another project. Python is better as a standalone platform because the library support is so much broader. See Lua Versus Python for more details.

Personally, I use both very frequently depending on the job at hand. I always use Lua for embedding into C/C++ applications or scripting functionality that is imported from C/C++ shared libraries (i.e. a DLL). Python is always my first choice for standalone tasks that do not require low-level C/C++ code.


I'd put my two cents in for python. I don't know a lot of the details, but the computer graphics suite blender does a wonderful job of implementing python scripting.

As far as I can tell in blender 2.5 the interpreter is run from inside the executable,

import sys
sys.executable

shows /blender/blender.exe and there is good debugging support, it even has a full interactive interpreter inside.

For more info check out: http://www.blender.org/


I really like Lua for embedding, but just as another alternative, JavaScript is easily embeddable in C, C++ (SpiderMonkey and V8) and Java (Rhino) programs.


In addition to Tcl, Lua, and Javascript (all already mentioned), Guile is another language designed explicitly for this.


I'll add Tcl to the mix. It's designed to be easily embedded into other programs.


Need Your Help

MySQL Query Results in Memcached For Processing?

php mysql optimization memcached

I am working with tables containing millions of records and often have to run queries for reporting reasons against it which some can take hours depending on the level of joins and what not. I know...

Error: Java:31 cannot find symbol

java generics types

So I get this error while trying to compile my java program