Skip to content

v1.3

Compare
Choose a tag to compare
@gengyong gengyong released this 21 Dec 09:22
· 3 commits to master since this release

support std::tuple now so we can return multiple values from c++ to Lua likes below.

void func1(const std::tuple<int, float, std::string>& args) {
    // do some things here ...
}

auto func2() {
    return std::make_tuple(123, "string A", "string B", 0.123f);
}

LuaModule testMod(L, "TestMod");
testMod.fun("modFunc1", func1);
testMod.fun("modFunc2", func2);

in Lua:

TestMod.modFunc1(1, 1.2, "from lua to c")

local values = TestMod.modFunc2()
print("Lua got multiple values from c++:")
for i = 1, #values do 
    print("[" .. i .. "]" .. values[i]) 
end