This is a Flutter plugin that embeds a Lua interpreter and runtime for executing dynamic scripts from Flutter apps.
-
Embeds a Lua 5.2 interpreter into your Flutter app.
-
Executes Lua code on a background thread (not on the main UI thread).
-
Supports executing source code snippets from strings as well as from source files bundled in your app's asset bundle.
Android and iOS both.
import 'package:flutter_lua/flutter_lua.dart' show Lua;
print(await Lua.version);
import 'package:flutter_lua/flutter_lua.dart' show LuaThread;
var thread = await LuaThread.spawn();
import 'package:flutter_lua/flutter_lua.dart' show LuaThread;
var thread = await LuaThread.spawn();
await thread.eval("return 6 * 7"); //=> 42.0
import 'package:flutter_lua/flutter_lua.dart' show LuaThread;
var thread = await LuaThread.spawn();
await thread.execAsset("scripts/myscript.lua");
About 3.8 MiB, at present.
- Currently the only supported result datatypes from
LuaThread#eval*()
methods are booleans, floating-point numbers (doubles), and strings. This will be extended further over the next releases.