Exemple #1
0
    static int _CreateMissingReferenceException(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 0)
        {
            MissingReferenceException obj = new MissingReferenceException();
            LuaScriptMgr.PushObject(L, obj);
            return(1);
        }
        else if (count == 1)
        {
            string arg0 = LuaScriptMgr.GetString(L, 1);
            MissingReferenceException obj = new MissingReferenceException(arg0);
            LuaScriptMgr.PushObject(L, obj);
            return(1);
        }
        else if (count == 2)
        {
            string    arg0 = LuaScriptMgr.GetString(L, 1);
            Exception arg1 = LuaScriptMgr.GetNetObject <Exception>(L, 2);
            MissingReferenceException obj = new MissingReferenceException(arg0, arg1);
            LuaScriptMgr.PushObject(L, obj);
            return(1);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: MissingReferenceException.New");
        }

        return(0);
    }
Exemple #2
0
    public static int constructor(IntPtr l)
    {
        int result;

        try
        {
            int num = LuaDLL.lua_gettop(l);
            if (num == 1)
            {
                MissingReferenceException o = new MissingReferenceException();
                LuaObject.pushValue(l, true);
                LuaObject.pushValue(l, o);
                result = 2;
            }
            else if (num == 2)
            {
                string message;
                LuaObject.checkType(l, 2, out message);
                MissingReferenceException o = new MissingReferenceException(message);
                LuaObject.pushValue(l, true);
                LuaObject.pushValue(l, o);
                result = 2;
            }
            else if (num == 3)
            {
                string message2;
                LuaObject.checkType(l, 2, out message2);
                Exception innerException;
                LuaObject.checkType <Exception>(l, 3, out innerException);
                MissingReferenceException o = new MissingReferenceException(message2, innerException);
                LuaObject.pushValue(l, true);
                LuaObject.pushValue(l, o);
                result = 2;
            }
            else
            {
                result = LuaObject.error(l, "New object failed.");
            }
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }