MCPcopy Create free account
hub / github.com/Tencent/UnLua / unwrap

Function unwrap

Plugins/UnLuaExtensions/LuaSocket/Source/src/except.cpp:73–84  ·  view source on GitHub ↗

-------------------------------------------------------------------------*\ * Protect factory \*-------------------------------------------------------------------------*/

Source from the content-addressed store, hash-verified

71* Protect factory
72\*-------------------------------------------------------------------------*/
73static int unwrap(lua_State *L) {
74 if (lua_istable(L, -1) && lua_getmetatable(L, -1)) {
75 int r = lua_rawequal(L, -1, lua_upvalueindex(1));
76 lua_pop(L, 1);
77 if (r) {
78 lua_pushnil(L);
79 lua_rawgeti(L, -2, 1);
80 return 1;
81 }
82 }
83 return 0;
84}
85
86static int protected_finish(lua_State *L, int status, lua_KContext ctx) {
87 (void)ctx;

Callers 1

protected_finishFunction · 0.85

Calls 4

lua_getmetatableFunction · 0.85
lua_rawequalFunction · 0.85
lua_pushnilFunction · 0.85
lua_rawgetiFunction · 0.85

Tested by

no test coverage detected