Beispiel #1
0
        static int __CreateInstance(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
                if (LuaAPI.lua_gettop(L) == 3 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && (LuaAPI.lua_isnil(L, 3) || LuaAPI.lua_type(L, 3) == LuaTypes.LUA_TSTRING))
                {
                    int    _error   = LuaAPI.xlua_tointeger(L, 2);
                    string _message = LuaAPI.lua_tostring(L, 3);

                    DCET.Model.RpcException gen_ret = new DCET.Model.RpcException(_error, _message);
                    translator.Push(L, gen_ret);

                    return(1);
                }
                if (LuaAPI.lua_gettop(L) == 4 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && (LuaAPI.lua_isnil(L, 3) || LuaAPI.lua_type(L, 3) == LuaTypes.LUA_TSTRING) && translator.Assignable <System.Exception>(L, 4))
                {
                    int              _error   = LuaAPI.xlua_tointeger(L, 2);
                    string           _message = LuaAPI.lua_tostring(L, 3);
                    System.Exception _e       = (System.Exception)translator.GetObject(L, 4, typeof(System.Exception));

                    DCET.Model.RpcException gen_ret = new DCET.Model.RpcException(_error, _message, _e);
                    translator.Push(L, gen_ret);

                    return(1);
                }
            }
            catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
            return(LuaAPI.luaL_error(L, "invalid arguments to DCET.Model.RpcException constructor!"));
        }
Beispiel #2
0
        static int _g_get_Error(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);

                DCET.Model.RpcException gen_to_be_invoked = (DCET.Model.RpcException)translator.FastGetCSObj(L, 1);
                LuaAPI.xlua_pushinteger(L, gen_to_be_invoked.Error);
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
            return(1);
        }