Frage

Within my code, I need to push an int onto Lua's stack. I know of the lua_pushnumber for C, but what would be used in LuaJ? I can't find a function for it, given that LuaJ isn't clear as to what functions represent certain C functions.

War es hilfreich?

Lösung

LuaJ abstracts things like stack management away. So if you're trying to call a Lua function, you don't have to push values onto the stack. Just get the Lua function as a LuaFunction variable and call it with the invoke method. To return multiple values from a Java function registered with Lua, you have to return a Varags object. You put your multiple values into that.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top