Developer Dennis D. Spreen has released an upgraded wrapper component for Lua 5.3 that allows you to run Lua scripts in Delphi XE7 Firemonkey. The wrapper which is called VerySimple.Lua uses the Lua static and dynamic libraries to enable the component on Android, IOS, Windows, and OSX. Between this component and paxCompiler you can now interpret Lua, Object Pascal, Basic, and Javascript on all four Firemonkey platforms at runtime. Blizzard uses Lua as the scripting language in World of Warcraft as one example of where people use Lua. There is some sample code for using the wrapper on the blog post itself. There is also more sample code for using VerySimple.Lua and interpreting Lua scripts in both FMX and VCL on Google Code and in the download. This Lua scripting interpreter component should also work with Appmethod. It is free and full source code is available. A dynamic library is used on Android, OSX, and Windows. A static library is used on IOS. I looked through the code and here is a snippet for how it loads the dynamic Lua library:
{$IFNDEF STATICLIBRARY}
// check if Library exists
if not FileExists(LoadPath) then
raise ELuaLibraryNotFound.Create('Lua library "' + QuotedStr(LoadPath) + '" not found');
// try to load the library
LibraryHandle := LoadLibrary(PChar(LoadPath));
if LibraryHandle = 0 then
raise ELuaLibraryLoadError.Create('Failed to load Lua library "' + QuotedStr(LoadPath) + '"'
{$IF defined(POSIX)} + (String(dlerror)){$ENDIF});
lua_newstate := GetAddress('lua_newstate');
lua_close := GetAddress('lua_close');
Head over and download the full source code for the Lua scripting interpreter for Delphi XE7 Firemonkey on Android, IOS, OSX, and Windows.
Here’s a question…does Apple allow scripting languages in iOS apps in the store? They didn’t in the past.
If they do, that opens up a whole new class of application for development.
On the Windows and OSX side, it adds to our ability to extend our applications.
Very well done!
Right, in the past they did not. You can use it in IOS Enterprise applications (since those don’t go through the App Store). Also there are IDEs with scripting languages in the App Store so they may have either loosened their restrictions or it’s on a case by case basis.
It wasn’t allowed in the very past. but apple relaxed the sdk terms in late 2010 to allow some scripting (with lua), “Application may use embedded interpreted code in a limited way if such use is solely for providing minor features or functionality that are consistent with the intended and advertised purpose of the Application”. For example there is Corona which uses Lua for scripting.