Types/table: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(Created page with "{{stub}} A simple Lua table. See: http://www.lua.org/pil/2.5.html")
 
(Note how array indexing works in Lua vs property tree)
Line 1: Line 1:
{{stub}}
A simple Lua table. See: http://www.lua.org/pil/2.5.html
A simple Lua table. See: http://www.lua.org/pil/2.5.html
Array-like Lua tables are typically 1-indexed.
Tables used by prototypes may parsed via an internal class called "property tree". Errors that reference this class treat tables as 0-indexed.<br>
For example <code>Value must be a dictionary in property tree at ROOT.lab.lab.light[0]</code> refers to element 0 of the property tree array which in Lua is at index 1.

Revision as of 17:06, 24 March 2022

A simple Lua table. See: http://www.lua.org/pil/2.5.html

Array-like Lua tables are typically 1-indexed.

Tables used by prototypes may parsed via an internal class called "property tree". Errors that reference this class treat tables as 0-indexed.
For example Value must be a dictionary in property tree at ROOT.lab.lab.light[0] refers to element 0 of the property tree array which in Lua is at index 1.