defs¶
A global table of functions: defs.<function>(…).
get¶
defs.get: (type: string, id: string) -> any?
The definition of this type (the element's name) and id as a read-only table of its attributes and child elements, or nil. The same table every time.
all¶
defs.all: (type: string) -> { any }
Every definition of a type, in load order, as a new list of the read-only tables get gives.
on_change¶
defs.on_change: (callback: () -> ()) -> ()
Calls the function when the definitions are reloaded (a file changed while the game runs); read them again with get and all. A module that is reloaded registers its listener again.
types¶
defs.types: () -> { string }
The types that have definitions, sorted.
sources¶
defs.sources: (type: string, id: string) -> { DefSource }
The files that made a definition: the one that defined it, then each one that patched it, in load order.
problems¶
defs.problems: () -> { DefProblem }
What is wrong in the definitions: a severity ("error" or "warning"), the file and line, a path inside the definition, and a message.