lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I'm trying to call a module function from C. What I tried to do was this:

lua_getglobal(GetLuaState(), "hook.Call");
lua_pushstring(GetLuaState(), "Think");
if(lua_pcall(GetLuaState(), 1, 1, 0) == 0)
{
    /* get the result */
    int sum = (int)lua_tointeger(GetLuaState(), -1);
    lua_pop(GetLuaState(), 1);
}

This doesn't work, and I understand that you cannot access a module function
like this. I'm trying to call the Call function of the hook module. How
would I do this correctly?