lua-users home
lua-l archive

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


Hello Lua Users

I have a problem with my code where I try to transfer a void* from C to Lua.

I have the following code:

/* function: me_NodeSelectByPointer */
static int tolua_ome_me_NodeSelectByPointer00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
    tolua_Error tolua_err;
    if (
        !tolua_isuserdata(tolua_S,1,0,&tolua_err) ||
        !tolua_isnoobj(tolua_S,2,&tolua_err)
        )
        goto tolua_lerror;
    else
#endif
    {
        void* _pointer =  tolua_touserdata(tolua_S, 1, NULL);
        {
            int tolua_ret = (int)  me_NodeSelectByPointer(_pointer);
            tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
        }
    }
    return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
    tolua_error(tolua_S,"#ferror in function 'me_NodeSelectByPointer'.",&tolua_err);
    return 0;
#endif
}

but pointer is always NULL??

What am I doing wrong?

/Jacob