MCPcopy Create free account
hub / github.com/Tencent/xLua / xlua_tocsobj_safe

Function xlua_tocsobj_safe

WebGLPlugins/xlua.c:46–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46LUA_API int xlua_tocsobj_safe(lua_State *L,int index) {
47 int *udata = (int *)lua_touserdata (L,index);
48 if (udata != NULL) {
49 if (lua_getmetatable(L,index)) {
50 lua_pushlightuserdata(L, &tag);
51 lua_rawget(L,-2);
52 if (!lua_isnil (L,-1)) {
53 lua_pop (L, 2);
54 return *udata;
55 }
56 lua_pop (L, 2);
57 }
58 }
59 return -1;
60}
61
62LUA_API int xlua_tocsobj_fast (lua_State *L,int index) {
63 int *udata = (int *)lua_touserdata (L,index);

Callers

nothing calls this directly

Calls 4

lua_touserdataFunction · 0.85
lua_getmetatableFunction · 0.85
lua_pushlightuserdataFunction · 0.85
lua_rawgetFunction · 0.85

Tested by

no test coverage detected