Free Lua Scripting Interpreter Library For Delphi XE7 Firemonkey On Android And IOS

http://www.fmxexpress.com/free-lua-scripting-interpreter-library-for-delphi-xe7-firemonkey-on-android-and-ios/

http://blog.spreendigital.de/tag/delphi/

http://blog.spreendigital.de/2015/02/18/verysimple-lua-2-0-a-cross-platform-lua-5-3-0-wrapper-for-delphi-xe5-xe7/

 

Dynamic library vs. static library VerySimple.Lua uses the lua dynamic library if compiled for Windows, Mac OS X or Android and uses the static library if compiled for iOS (all libraries included).

Unit tests < excuse type=”lame”>This binding is based on my now 6 year old Lua 5.1 delphi binding, and I didn’t had time for writing (updated) unit tests</excuse>.

Automatic get/setters for properties, etc. As the name implies: it is just a very simple Lua <-> delphi binding. Feel free to add those functions by yourself.

Tags: binding, Delphi Programming, Lua

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’);

 

http://blog.spreendigital.de/2015/02/18/verysimple-lua-2-0-a-cross-platform-lua-5-3-0-wrapper-for-delphi-xe5-xe7/

 

VerySimple.Lua is a Lua 5.3 binding for Delphi XE5- XE7 which automatically creates OOP callback functions for Win32, Win64, Mac OS X, iOS and Android. “Lua is a powerful, fast, lightweight, embeddable scripting language, it has been used in many industrial applications (e.g., Adobe’s Photoshop Lightroom), with an emphasis on embedded systems (e.g., the Ginga middleware for digital TV in Brazil) and games (e.g., World of Warcraft). Lua is currently the leading scripting language in games and it has a deserved reputation for performance. To claim to be “as fast as Lua” is an aspiration of other scripting languages.”

Download current version at Google Code

What’s new in v2.0?

 

  • Lua 5.3.0 support (all header translations done from scratch)
  • cross-platform – Windows 32 bit, Windows 64 bit, Mac OS X, iOS and Android
  • improved autoregister function – with the help of TRtti it registers only valid methods
  • simplified callback with upvalues instead of pointer list
  • package support
  • examples included (VCL and Firemonkey)

Example 1 – Simple usage

Example 2 – Extend Lua with own functions

helloworld.lua

Output:

 

转载于:https://www.cnblogs.com/fanbbs/p/4300430.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值