Skip to content

Latest commit

 

History

History
44 lines (33 loc) · 736 Bytes

File metadata and controls

44 lines (33 loc) · 736 Bytes

Stringify

JSON-like value stringification
Version 0.1.8
Chadnaut 2024
https://github.com/Chadnaut/Attract-Mode-Modules

Quickstart

::fe.load_module("stringify");

local object = { a = 1, b = 2.0, c = ["d", "e"] };
print(stringify(object) + "\n");
{ a = 1, b = 2.0, c = ["d", "e"] }

Pretty printing:

print(stringify(object, "  ") + "\n");
{
  a = 1, 
  b = 2.0, 
  c = [
    "d", 
    "e"
  ]
}

Pass stringify any value and it will convert it into a string, handy for printing to last_run.log.

Function

  • stringify(value, space?) - Returns a string.
    • value any - The value to stringify.
    • space string - (Optional) Indent for pretty-printing.