Ejemplo n.º 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) && translator.Assignable <System.Type>(L, 3))
                {
                    int         _tag       = LuaAPI.xlua_tointeger(L, 2);
                    System.Type _knownType = (System.Type)translator.GetObject(L, 3, typeof(System.Type));

                    ProtoBuf.ProtoIncludeAttribute gen_ret = new ProtoBuf.ProtoIncludeAttribute(_tag, _knownType);
                    translator.Push(L, gen_ret);

                    return(1);
                }
                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    _tag           = LuaAPI.xlua_tointeger(L, 2);
                    string _knownTypeName = LuaAPI.lua_tostring(L, 3);

                    ProtoBuf.ProtoIncludeAttribute gen_ret = new ProtoBuf.ProtoIncludeAttribute(_tag, _knownTypeName);
                    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 ProtoBuf.ProtoIncludeAttribute constructor!"));
        }
Ejemplo n.º 2
0
        static int _g_get_Tag(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);

                ProtoBuf.ProtoIncludeAttribute gen_to_be_invoked = (ProtoBuf.ProtoIncludeAttribute)translator.FastGetCSObj(L, 1);
                LuaAPI.xlua_pushinteger(L, gen_to_be_invoked.Tag);
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
            return(1);
        }
Ejemplo n.º 3
0
        static int _s_set_DataFormat(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);

                ProtoBuf.ProtoIncludeAttribute gen_to_be_invoked = (ProtoBuf.ProtoIncludeAttribute)translator.FastGetCSObj(L, 1);
                ProtoBuf.DataFormat            gen_value; translator.Get(L, 2, out gen_value);
                gen_to_be_invoked.DataFormat = gen_value;
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
            return(0);
        }