An alternative to embedding Python 

As mentioned in an earlier post itis possible to embed Python into a c/c++ application, but this is not a feature that is unique just to Python. Lua is another scripting language that not only is capable of being embedded but was designed for it.

Like Python Lua uses a c API to allow you to embed it but it is a bit simpler and easier to use than that provided by the Python c API. Lua also has an interesting feature which is not available in Python which is the ability to return multiple values from a function, while this will likely not be used a lot even I have come across a few functions of my own where this would have been useful.

If you want to give learning Lua a try then a good place to start would be the books listed on their their is even a free version of an old edition that can be viewed online.

Programming in Lua book
There is another reason to learn Lua than to embed it in your own applications which is because others have embedded it in theirs. There are already a number of applications out there that use Lua for scripting such as Conky a system monitor. Conky lets you change what’s displayed using a configuration file which is simple to edit, but if you want to really make it look fancy then you will need to use Lua scripts. This is just one of many applications that use Lua some more popular than others.

So if you want to embed it into your own applications or if you have an application that you want to modify that uses it for a scripting language or maybe you want to use it as a stand alone language for your own applications, Lua might be something worth looking at.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s