예제 #1
0
        public LuaFunction CreateFunction(object target, MethodBase function)
        {
            int newTop = LuaDLL.lua_gettop(this.L);
            LuaMethodWrapper wrapper = new LuaMethodWrapper(this.translator, target, function.DeclaringType, function);

            this.translator.push(this.L, new LuaCSFunction(wrapper.call));
            object      obj2      = this.translator.getObject(this.L, -1);
            LuaFunction function2 = !(obj2 is LuaCSFunction) ? ((LuaFunction)obj2) : new LuaFunction((LuaCSFunction)obj2, this);

            LuaDLL.lua_settop(this.L, newTop);
            return(function2);
        }
예제 #2
0
        public LuaFunction RegisterFunction(string path, object target, MethodBase function)
        {
            int newTop = LuaDLL.lua_gettop(this.L);
            LuaMethodWrapper wrapper = new LuaMethodWrapper(this.translator, target, function.DeclaringType, function);

            this.translator.push(this.L, new LuaCSFunction(wrapper.call));
            this[path] = this.translator.getObject(this.L, -1);
            LuaFunction function2 = this.GetFunction(path);

            LuaDLL.lua_settop(this.L, newTop);
            return(function2);
        }
예제 #3
0
        public LuaFunction CreateFunction(object target, MethodBase function)
        {
            int newTop = LuaDLL.lua_gettop(this.L);
            LuaMethodWrapper @object = new LuaMethodWrapper(this.translator, target, function.get_DeclaringType(), function);

            this.translator.push(this.L, new LuaCSFunction(@object.call));
            object      object2 = this.translator.getObject(this.L, -1);
            LuaFunction result  = (!(object2 is LuaCSFunction)) ? ((LuaFunction)object2) : new LuaFunction((LuaCSFunction)object2, this);

            LuaDLL.lua_settop(this.L, newTop);
            return(result);
        }