StendhalScripting/LuaAPI: Difference between revisions

Jump to navigation Jump to search
Content deleted Content added
imported>AntumDeluge
entities: add link to Stendhal API
imported>AntumDeluge
Table Manipulation: table.contains & table.join
Line 640: Line 640:


The following methods have been added to the built-in Lua [https://www.lua.org/manual/5.3/manual.html#6.6 table] library.
The following methods have been added to the built-in Lua [https://www.lua.org/manual/5.3/manual.html#6.6 table] library.

; ''<span style="color:green;">table.concat</span>(tbl1, tbl2)''
: Merges the contents of one table into another.
: '''''tbl1:''''' The table receiving the new content.
: '''''tbl2:''''' The table containing the content to be copied.

{{PublicMethod | table.contains | params=table, o | desc=Checks if a table contains a value. | paramlist=
{{MethodParam | table | type=table | desc=Table to be checked.}}
{{MethodParam | o | desc=The object to check for.}}
| ret=<code>true</code> if <code>o</code> is in <code>table</code>. | rettype=boolean }}


; ''<span style="color:green;">table.clean</span>(tbl)''
; ''<span style="color:green;">table.clean</span>(tbl)''
Line 646: Line 656:
: ''returns:'' Copy of <code>tbl</code> with <code>nil</code> values removed.
: ''returns:'' Copy of <code>tbl</code> with <code>nil</code> values removed.


{{PublicMethod | table.join | params=table, delim | desc=Joins a table of strings into a string. | paramlist=
; ''<span style="color:green;">table.concat</span>(tbl1, tbl2)''
{{MethodParam | table | type=table | desc=Table to be joined.}}
: Merges the contents of one table into another.
{{MethodParam | delim | type=string | desc=Character(s) to be used as separator.}}
: '''''tbl1:''''' The table receiving the new content.
| ret=The resulting string. | rettype=string }}
: '''''tbl2:''''' The table containing the content to be copied.


= See Also =
= See Also =