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

Function ImportType

Assets/XLua/Src/StaticLuaCallbacks.cs:848–877  ·  view source on GitHub ↗
(RealStatePtr L)

Source from the content-addressed store, hash-verified

846
847
848 [MonoPInvokeCallback(typeof(LuaCSFunction))]
849 public static int ImportType(RealStatePtr L)
850 {
851 try
852 {
853 ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
854 string className = LuaAPI.lua_tostring(L, 1);
855 Type type = translator.FindType(className);
856 if (type != null)
857 {
858 if (translator.GetTypeId(L, type) >= 0)
859 {
860 LuaAPI.lua_pushboolean(L, true);
861 }
862 else
863 {
864 return LuaAPI.luaL_error(L, "can not load type " + type);
865 }
866 }
867 else
868 {
869 LuaAPI.lua_pushnil(L);
870 }
871 return 1;
872 }
873 catch (System.Exception e)
874 {
875 return LuaAPI.luaL_error(L, "c# exception in xlua.import_type:" + e);
876 }
877 }
878
879 [MonoPInvokeCallback(typeof(LuaCSFunction))]
880 public static int ImportGenericType(RealStatePtr L)

Callers

nothing calls this directly

Calls 7

FindMethod · 0.80
lua_tostringMethod · 0.80
FindTypeMethod · 0.80
GetTypeIdMethod · 0.80
lua_pushbooleanMethod · 0.80
luaL_errorMethod · 0.80
lua_pushnilMethod · 0.80

Tested by

no test coverage detected