コード例 #1
0
        public Color(GLua gLua, Int32 IStackPos)
        {
            Boolean B = gLua.Lock();

            gLua.GetField(IStackPos, "r");
            this.R = (Byte)gLua.LuaBase.GetNumber(-1);
            gLua.GetField(IStackPos, "g");
            this.G = (Byte)gLua.LuaBase.GetNumber(-1);
            gLua.GetField(IStackPos, "b");
            this.B = (Byte)gLua.LuaBase.GetNumber(-1);
            gLua.GetField(IStackPos, "a");
            this.A = (Byte)gLua.LuaBase.GetNumber(-1);
            gLua.Pop(4);

            if (B)
            {
                gLua.UnLock();
            }
        }
コード例 #2
0
        public void Push(GLua gLua)
        {
            Boolean B = gLua.Lock();

            gLua.LuaBase.CreateTable();
            gLua.LuaBase.PushNumber(this.R);
            gLua.LuaBase.SetField(-2, "r");
            gLua.LuaBase.PushNumber(this.G);
            gLua.LuaBase.SetField(-2, "g");
            gLua.LuaBase.PushNumber(this.B);
            gLua.LuaBase.SetField(-2, "b");
            gLua.LuaBase.PushNumber(this.A);
            gLua.LuaBase.SetField(-2, "a");

            gLua.LuaBase.CreateMetaTable("COLOR");
            gLua.LuaBase.SetMetaTable(-2);

            if (B)
            {
                gLua.UnLock();
            }
        }