diff --git a/docs/object.md b/docs/object.md index 008bf5f0..011ab9a2 100644 --- a/docs/object.md +++ b/docs/object.md @@ -309,14 +309,14 @@ call([](types.md) func_name, [](types.md) | [:i:](#getdecals) getLuaScript() | Get a Lua script as a string from the entity. | [](types.md) | getSnapPoints() | Returns a table of sub-tables, each sub-table representing one snap point. | [](types.md) | [:i:](#getsnappoints) -getTable([](types.md) table_name) | Data value of a variable in another Object's script. Can only return a table. | [](types.md) | -getVar([](types.md) var_name) | Data value of a variable in another entity's script. Cannot return a table. | [](types.md) | +getTable([](types.md) table_name) | Data value of a variable in another Object's script. Can only return a table. See [setTable](#settable). | [](types.md) | +getVar([](types.md) var_name) | Data value of a variable in another entity's script. Cannot return a table. See [setVar](#setvar). | [](types.md) | getVectorLines() | Returns Table of data representing the current Vector Lines on this entity. See [setVectorLines](#setvectorlines) for table format.| [](types.md) | setDecals([](types.md) parameters) | Sets which decals are on an object. This removes other decals already present, and can remove all decals as well. | [](types.md) | [:i:](#setdecals) setLuaScript([](types.md) script) | Input a string as an entity's Lua script. Generally only used after spawning a new Object. | [](types.md) | setSnapPoints([](types.md) parameters) | Spawns snap points from a list of parameters. | [](types.md) | [:i:](#setsnappoints) -setTable([](types.md) func_name, [](types.md) data) | Creates/updates a variable in another entity's script. Only used for tables. | [](types.md) | -setVar([](types.md) func_name, [](types.md) data) | Creates/updates a variable in another entity's script. Cannot set a table. | [](types.md) | +setTable([](types.md) func_name, [](types.md) data) | Creates/updates a variable in another entity's script. Only used for tables. | [](types.md) | [:i:](#settable) +setVar([](types.md) func_name, [](types.md) data) | Creates/updates a variable in another entity's script. Cannot set a table. | [](types.md) | | [:i:](#setvar) setVectorLines([](types.md) parameters) | Spawns Vector Lines from a list of parameters on this entity. | [](types.md) | [:i:](#setvectorlines) @@ -1958,7 +1958,40 @@ self.setSnapPoints({ --- +####setTable(table_name, table) +[](types.md) Sets a table on the object that can be retrieved at a later time by calling [getTable](#gettable). + +Changing the table will not modify the value that is returned by calling [getTable](#gettable), instead [setTable](#settable) must be called again. + +The table is not stored with the object when the object is saved. Therefore, when the game is loaded the value returned by [getTable](#gettable) will be nil. + + +```Lua +local table = {state="hungry", size="big"} +self.setTable("details", table) +local read = self.getTable("details") +print(read["state"]) -- hungry +read['size'] = "small" +local read2 = self.getTable("details") +print(read2["size"]) -- big +self.setTable("details", read) +local read3 = self.getTable("details") +print(read3["size"]) -- small +``` + +--- + +####setVar(var_name, var) + +Creates/updates a variable in another entity's script. Cannot set a table. The value is retrieved by the function [getVar](#getvar). The value will not be saved when the object is saved. + +```Lua +self.setVar("state", "large") +print(self.getVar("state")) -- large +``` + +--- ####setVectorLines(...)