The LuaSaveDataValue field is used to store the actual data that is serialized. The type of this field depends on the Type field of the LuaSaveData structure.
The Nil type is used to represent a nil value in Lua. It does not have a value, as it is always nil. It is serialized as a byte array with a length of 0.
The Boolean type is used to represent a boolean value in Lua. It is serialized as a single bit, where 0 is false and 1 is true.
Field Name
Field Type
Notes
Value
Flag (1 bit)
The boolean value.
warning
The boolean type is serialized as a single bit, which means that the byte that contains the boolean value may contain other data as well. Any data after the boolean value is offset by 1 bit.
The Number type is used to represent a number in Lua. It is serialized as a 32-bit floating point number in big-endian format. Note that precision may be lost when serializing and deserializing numbers. The game uses this type to represent floating point numbers, and integers that do not fit within the 32-bit signed integer range.
The String type is used to represent a string in Lua. It is serialized as a length-prefixed, utf-8 encoded string. The length is a 32-bit unsigned integer in big-endian format, followed by the string data.
warning
The contents of the string must be aligned to a whole byte. If the length of the string data is not a multiple of 8 bits, padding is inserted between the length and the string data to align the string data to a whole byte.
Field Name
Field Type
Notes
Size
be u32
The amount of bytes required to store the utf-8 encoded string data.
The Table type is used to represent a table in Lua. It is serialized as a list of key-value pairs. The table can be either an array or a dictionary. The type of the table is determined by the Is Array field.
warning
The Is Array field is stored as a single bit. This means that the byte that contains the Is Array field may contain other data as well. Any data after the Is Array field is offset by 1 bit.
note
The Table type is a recursive structure, which means that tables can contain other tables.
The Int32 type is used to represent a 32-bit signed integer in Lua. It is serialized as a 32-bit signed integer in big-endian format. The game uses this type to represent integers that fit within the 32-bit signed integer range, but not within the 16-bit signed integer range.
The Int16 type is used to represent a 16-bit signed integer in Lua. It is serialized as a 16-bit signed integer in big-endian format. The game uses this type to represent integers that fit within the 16-bit signed integer range, but not within the 8-bit signed integer range.
This field requires more detailed documentation. Further explanation about its purpose, behavior, and usage is needed.
If you have any further information on this field, please create a Pull Request for this.
The WeakScriptRef type allows retrieveing objects from a defined list inside the LuaVM. It cannot be created from normal functions and is only ever used internally.
If you want to use this type, will may have to manually create the LuaObject yourself.
Field Name
Field Type
Notes
RefID
u32
The reference in
Unknown
Flag (1-bit)
Unknown flag. (During testing, The type only seem to work when this was set)
The RefID may point to a reference inside a pool stored in the LuaVM/LuaManager. The purpose of this type is not yet clear, however it is clearly not intended for modders.
The LuaUserdata type is used to represent a userdata object in Lua. It is serialized as a type ID followed by the data of the userdata object. The type ID is used to determine the type of the userdata object, and the data is specific to the type of the userdata object.