Example #1
0
 protected string Kst(uint v)
 {
     if (v >= 0 && v < parent.Constants.Count)
     {
         ObjLuaConstant oci = (ObjLuaConstant)parent.Constants[(int)v];
         if (oci.InstructionType == ObjLuaConstant.Type.String)
         {
             return(oci.String);
         }
         else if (oci.InstructionType == ObjLuaConstant.Type.Number)
         {
             return(oci.Value.ToString());
         }
         else
         {
             return("null");
         }
     }
     return(v.ToString());
 }
Example #2
0
        internal void Unserialize(System.IO.BinaryReader reader)
        {
            contants.Clear();
            functions.Clear();
            codes.Clear();
            srcln.Clear();
            local.Clear();
            upval.Clear();

            name = ObjLua.ReadString(reader);

            linedef = reader.ReadUInt32();
            nups    = reader.ReadByte();
            argc    = reader.ReadByte();
            isinout = reader.ReadByte();
            stacksz = reader.ReadByte();

            uint linenfosz = reader.ReadUInt32();

            for (uint i = 0; i < linenfosz; i++)
            {
                ObjLuaSourceLine item = new ObjLuaSourceLine(this);
                item.Unserialize(reader);

                srcln.Add(item);
            }

            uint locvarsz = reader.ReadUInt32();

            for (uint i = 0; i < locvarsz; i++)
            {
                ObjLuaLocalVar item = new ObjLuaLocalVar(this);
                item.Unserialize(reader);

                local.Add(item);
            }

            uint upvalsz = reader.ReadUInt32();

            for (uint i = 0; i < upvalsz; i++)
            {
                ObjLuaUpValue item = new ObjLuaUpValue(this);
                item.Unserialize(reader);

                upval.Add(item);
            }

            uint constsz = reader.ReadUInt32();

            for (uint i = 0; i < constsz; i++)
            {
                ObjLuaConstant item = new ObjLuaConstant(this);
                item.Unserialize(reader);

                contants.Add(item);
            }

            uint fncsz = reader.ReadUInt32();

            for (uint i = 0; i < fncsz; i++)
            {
                ObjLuaFunction item = new ObjLuaFunction(this.parent);
                item.Unserialize(reader);

                functions.Add(item);
            }

            uint codesz = reader.ReadUInt32();

            for (uint i = 0; i < codesz; i++)
            {
                ObjLuaCode item = ObjLuaCode.Unserialize(reader, this);

                codes.Add(item);
            }
        }