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

Method getLuaFunction

Assets/XLua/Src/ObjectCasters.cs:408–421  ·  view source on GitHub ↗
(RealStatePtr L, int idx, object target)

Source from the content-addressed store, hash-verified

406 }
407
408 private object getLuaFunction(RealStatePtr L, int idx, object target)
409 {
410 if (LuaAPI.lua_type(L, idx) == LuaTypes.LUA_TUSERDATA)
411 {
412 object obj = translator.SafeGetCSObj(L, idx);
413 return (obj != null && obj is LuaFunction) ? obj : null;
414 }
415 if (!LuaAPI.lua_isfunction(L, idx))
416 {
417 return null;
418 }
419 LuaAPI.lua_pushvalue(L, idx);
420 return new LuaFunction(LuaAPI.luaL_ref(L), translator.luaEnv);
421 }
422
423 public void AddCaster(Type type, ObjectCast oc)
424 {

Callers

nothing calls this directly

Calls 5

lua_typeMethod · 0.80
SafeGetCSObjMethod · 0.80
lua_isfunctionMethod · 0.80
lua_pushvalueMethod · 0.80
luaL_refMethod · 0.80

Tested by

no test coverage detected