Module system.serialization.lua

Lua table encoder/decoder

Index

Function

decode()

Parses a serialized Lua string and returns a Lua value represented by the string.

encode()

Serializes an arbitrary Lua object into a serialized Lua string.

load()

Loads a serialized Lua file into a Lua value.

save()

Saves a Lua value to a serialized Lua file.

API Reference

system.serialization.lua.encode(
    val: any,
    opts?: {minified: boolean, allow_functions: boolean}
): (result: string)

Serializes an arbitrary Lua object into a serialized Lua string.

Parameters:
  • val (any) – The value to encode

  • opts? ({minified: boolean, allow_functions: boolean}) – Any options to specify while encoding

Returns:

result (string) – The serialized Lua representation of the object

system.serialization.lua.decode(str: string, opts?: {allow_functions: boolean}): (result: any)

Parses a serialized Lua string and returns a Lua value represented by the string.

Parameters:
  • str (string) – The serialized Lua string to decode

  • opts? ({allow_functions: boolean}) – Any options to specify while decoding

Returns:

result (any) – The Lua value from the serialized Lua

system.serialization.lua.save(
    val: any,
    path: string,
    opts?: {minified: boolean, allow_functions: boolean}
)

Saves a Lua value to a serialized Lua file.

Parameters:
  • val (any) – The value to save

  • path (string) – The path to the file to save

  • opts? ({minified: boolean, allow_functions: boolean}) – Any options to specify while encoding

system.serialization.lua.load(path: string, opts?: {allow_functions: boolean}): (result: any)

Loads a serialized Lua file into a Lua value.

Parameters:
  • path (string) – The path to the file to load

  • opts? ({allow_functions: boolean}) – Any options to specify while decoding

Returns:

result (any) – The loaded value