stendhal/doc/mkdocs/lua/objects/tables.md
2023-05-17 02:08:58 -07:00

2.1 KiB


Contents

[TOC]


Table Manipulation

Global table variable: table


Description

The following methods have been added to the built-in Lua table table.


Methods


table.clean

table.clean (tbl)
  • Removes nil values from a table.
  • Parameters:
    • tbl: (table) The table to be cleaned.
  • Returns: (table)
    • Copy of tbl with nil values removed.

table.concat

table.concat (tbl1, tbl2)
  • Merges the contents of one table into another.
  • Parameters:
    • tbl1: (table) The table receiving the new content.
    • tbl2: (table) The table containing the content to be copied.

table.contains

table.contains (table, o)
  • Checks if a table contains a value.
  • Parameters:
    • table: (table) Table to be checked.
    • obj: (Object) The object to check for.
  • Returns: (bool)
    • true if obj is in table.

table.join

table.join (table, delim)
  • Converts a list of strings into a string.
  • Parameters:
    • table: (table) Table to be joined.
    • delim: (string) Character(s) to be used as separator.
  • Returns: (string)
    • The resulting string.