예제 #1
0
 public static void Register(IntPtr ptr)
 {
     LuaObject.GetTypeTable(ptr, "Slua.ByteArray");
     LuaObject.AddMember(ptr, SetData);
     LuaObject.AddMember(ptr, Clear);
     LuaObject.AddMember(ptr, GetData);
     LuaObject.AddMember(ptr, ReadBool);
     LuaObject.AddMember(ptr, ReadInt);
     LuaObject.AddMember(ptr, ReadUInt);
     LuaObject.AddMember(ptr, ReadChar);
     LuaObject.AddMember(ptr, ReadUChar);
     LuaObject.AddMember(ptr, ReadByte);
     LuaObject.AddMember(ptr, Read);
     LuaObject.AddMember(ptr, ReadSByte);
     LuaObject.AddMember(ptr, ReadShort);
     LuaObject.AddMember(ptr, ReadUShort);
     LuaObject.AddMember(ptr, ReadInt16);
     LuaObject.AddMember(ptr, ReadUInt16);
     LuaObject.AddMember(ptr, ReadInt64);
     LuaObject.AddMember(ptr, ReadFloat);
     LuaObject.AddMember(ptr, ReadDouble);
     LuaObject.AddMember(ptr, ReadString);
     LuaObject.AddMember(ptr, WriteByteArray);
     LuaObject.AddMember(ptr, WriteBool);
     LuaObject.AddMember(ptr, WriteInt);
     LuaObject.AddMember(ptr, WriteUInt);
     LuaObject.AddMember(ptr, WriteChar);
     LuaObject.AddMember(ptr, WriteByte);
     LuaObject.AddMember(ptr, WriteUChar);
     LuaObject.AddMember(ptr, WriteSByte);
     LuaObject.AddMember(ptr, WriteUShort);
     LuaObject.AddMember(ptr, WriteShort);
     LuaObject.AddMember(ptr, WriteFloat);
     LuaObject.AddMember(ptr, WriteNum);
     LuaObject.AddMember(ptr, WriteString);
     LuaObject.AddMember(ptr, WriteInt64);
     LuaObject.AddMember(ptr, ReadVarInt);
     LuaObject.AddMember(ptr, WriteVarInt);
     LuaObject.AddMember(ptr, ReadInt48);
     LuaObject.AddMember(ptr, ReadInt48L);
     LuaObject.AddMember(ptr, WriteInt48);
     LuaObject.AddMember(ptr, ReadByteArray);
     LuaObject.AddMember(ptr, ReadUInt64);
     LuaObject.AddMember(ptr, ReadBytes);
     LuaObject.AddMember(ptr, WriteBytes);
     LuaObject.AddMember(ptr, "Length", GetLength, null, true);
     LuaObject.AddMember(ptr, "Position", GetPosition, SetPosition, true);
     LuaObject.CreateTypeMetatable(ptr, Constructor, typeof(ByteArray));
 }
예제 #2
0
        public static void Register(IntPtr ptr)
        {
            LuaObject.GetTypeTable(ptr, "Slua");
            LuaObject.AddMember(ptr, CreateAction, false);
            LuaObject.AddMember(ptr, CreateClass, false);
            LuaObject.AddMember(ptr, GetClass, false);
            LuaObject.AddMember(ptr, Iterator, false);
            LuaObject.AddMember(ptr, ToString, false);
            LuaObject.AddMember(ptr, As, false);
            LuaObject.AddMember(ptr, IsNull, false);
            LuaObject.AddMember(ptr, MakeArray, false);
            LuaObject.AddMember(ptr, ToBytes, false);
            LuaObject.AddMember(ptr, "out", GetOut, null, false);
            LuaObject.AddMember(ptr, "version", GetVersion, null, false);

            LuaFunction function = LuaState.Get(ptr).DoString(ClassFunction) as LuaFunction;

            function.Push(ptr);
            LuaNativeMethods.lua_setfield(ptr, -3, "Class");
            LuaObject.CreateTypeMetatable(ptr, null, typeof(Helper));
        }