Вопрос

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.

Это было полезно?

Решение

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top