flutter_lua 0.3.1

Flutter Android iOS

Lua interpreter and runtime for executing dynamic scripts in Flutter apps.

Flutter Lua Plugin #

Project license Pub package Dartdoc reference Travis CI build status

This is a Flutter plugin that embeds a Lua interpreter and runtime for executing dynamic scripts from Flutter apps.

Features #

  • 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.

Compatibility #

Android and iOS both.

Examples #

Checking the Lua runtime version #

import 'package:flutter_lua/flutter_lua.dart' show Lua;

print(await Lua.version);

Spawning a new Lua interpreter thread #

import 'package:flutter_lua/flutter_lua.dart' show LuaThread;

var thread = await LuaThread.spawn();

Evaluating a Lua code snippet #

import 'package:flutter_lua/flutter_lua.dart' show LuaThread;

var thread = await LuaThread.spawn();

await thread.eval("return 6 * 7"); //=> 42.0

Executing a bundled Lua source file #

import 'package:flutter_lua/flutter_lua.dart' show LuaThread;

var thread = await LuaThread.spawn();

await thread.execAsset("scripts/myscript.lua");

Frequently Asked Questions #

How much does using this plugin increase my final app size? #

About 3.8 MiB, at present.

Caveats #

  • 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.
10
likes
100
pub points
27%
popularity

Lua interpreter and runtime for executing dynamic scripts in Flutter apps.

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

arto@bendiken.net

License

Unlicense (UNLICENSE)

Dependencies

flutter, meta

More

Packages that depend on flutter_lua