CityRP Documentation Repository

dumper

Variable dumping/inspection helpers.

Functions

Sharedexport(var, level, seen, strict) → stringSource ☍

Provides a human & machine readable version of variables. Equivilent to PHP's var_export: the output compiles back to an equivalent value, except that functions, panels and cyclic references become commented placeholders unless strict is set.

Parameters

  • varanyInput variable.
  • levelnumber?Initial indent level, for tables. Defaults to 0.
  • seentable<table, boolean?>?Tables currently being exported above this one, used to detect cyclic references. Defaults to an empty table.
  • strictboolean?Raise an error on a value with no Lua form or a cyclic reference, instead of writing a placeholder.

Returns

  1. stringReadable version.
Sharedinspect(var, level, seen) → stringSource ☍

Provides a human readable version of variables. Equivilent to PHP's print_r or var_dump.

Parameters

  • varanyInput variable.
  • levelnumber?Initial indent level, for tables. Defaults to 0.
  • seentable<table, boolean?>?Tables currently being expanded above this one, used to detect cyclic references. Defaults to an empty table.

Returns

  1. stringReadable version.
Sharedkeyify(var, level, seen, strict) → stringSource ☍

Converts a variable into a table key for export's output.

Parameters

  • varanyInput variable.
  • levelnumber?Indent level of the entry, used when the key is itself a table. Defaults to 0.
  • seentable<table, boolean?>?Tables currently being exported, as for export.
  • strictboolean?Raise instead of writing a placeholder, as for export.

Returns

  1. stringA bare identifier, or the exported value in brackets.