(RealStatePtr L)
| 917 | } |
| 918 | |
| 919 | [MonoPInvokeCallback(typeof(LuaCSFunction))] |
| 920 | public static int Cast(RealStatePtr L) |
| 921 | { |
| 922 | try |
| 923 | { |
| 924 | ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); |
| 925 | Type type; |
| 926 | translator.Get(L, 2, out type); |
| 927 | |
| 928 | if (type == null) |
| 929 | { |
| 930 | return LuaAPI.luaL_error(L, "#2 param[" + LuaAPI.lua_tostring(L, 2) + "]is not valid type indicator"); |
| 931 | } |
| 932 | LuaAPI.luaL_getmetatable(L, type.FullName); |
| 933 | if (LuaAPI.lua_isnil(L, -1)) |
| 934 | { |
| 935 | return LuaAPI.luaL_error(L, "no gen code for " + LuaAPI.lua_tostring(L, 2)); |
| 936 | } |
| 937 | LuaAPI.lua_setmetatable(L, 1); |
| 938 | return 0; |
| 939 | } |
| 940 | catch (System.Exception e) |
| 941 | { |
| 942 | return LuaAPI.luaL_error(L, "c# exception in xlua.cast:" + e); |
| 943 | } |
| 944 | } |
| 945 | |
| 946 | static Type getType(RealStatePtr L, ObjectTranslator translator, int idx) |
| 947 | { |
nothing calls this directly
no test coverage detected