Skip to content
Switch branches/tags
This branch is 6 commits ahead of kevinresol:master.

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


This repo is forked from the original MattTuttle/hx-lua.

What's different: correctly supports both neko and cpp, also added luafilesystem library into lua

The ndll's are not up-to-date. Run flow build lua windows --clean, for x64 flow build lua windows --arch 64 --clean, or lime rebuild lua windows -clean to rebuild the ndll (replace windows with other platforms at will)

Run Lua code in Haxe

Run any Lua code inside Haxe on neko/cpp targets. Has the option of passing a context object that will set variables before running the script.

var result ="return true"); // returns a Bool to Haxe

Pass in values with a context object. The key names are used as variable names in the Lua script.

var result ="if num > 14 then return 14 else return num end", {num: 15.3});

What if you want to call a function created in Haxe from Lua? Just pass the function in the context!

var result ="return plus1(15)", { plus1: function(val:Int) { return val + 1; } });
if (result == 16)

Lua instances

It's possible to create multiple Lua instances to run scripts with different contexts/libraries.

var lua = new Lua();
lua.loadLibs(["base", "math"]);
lua.setVars({ myVar: 1 });
var result = lua.execute("return myVar");

Calling Lua functions

Calling global functions defined in lua can be done after executing a chunk of Lua code. You can either pass in a single value (for single argument functions) or an array (for multiple argument functions).

var lua = new Lua();
lua.execute("function add(a, b) return a + b end");
var result ="add", [1, 5]); // returns 6


Simple lua wrapper in a haxe extension



No releases published


No packages published