开发者

Scripting Languages [closed]

Closed. This question is opinion-based. It is not currently accepting answers.

Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.

Closed 9 years ago.

Improve this question

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 inst开发者_Go百科allations). 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?


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:

  • static linking? check!
  • debugging? check!


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜