Skip to main content
gamedev.net
🔒 Locked

luaplus register a function to lua

Started by huaner 0 replies 1.1k views
Original Post
huaner
huaner
hi: I want to a function which is registered to lua. my lua is:

x, y, z = GetPosition()

so ,first i must register it

state->GetGlobals().Register("GetPosition", LS_GetPosition);

int LS_GetPosition(LuaState* state)
{

     return 0;

}


how to write the function of LS_GetPosition? 3Q
Luth
Luth
int LS_GetPosition(LuaState* state){     lua_pushnumber(1.23);     lua_pushnumber(4.56);     lua_pushnumber(7.89);     return 3;}

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.