Top "Lua-table" questions

This tag refers to the table type in Lua that implements associative arrays.

How to check if a table contains an element in Lua?

Is there a method for checking if a table contains a value ? I have my own (naive) function, but I …

lua set unique contains lua-table
How to iterate through table in Lua?

So, I have a table something along these lines: arr = { apples = { 'a', "red", 5 }, oranges = { 'o', "orange", 12 }, pears = { 'p', "green", 7 } } It …

arrays loops lua key lua-table
Search for an item in a Lua list

If I have a list of items like this: local items = { "apple", "orange", "pear", "banana" } how do I check if "…

list lua lua-table
How do I append to a table in Lua

I'm trying to figure out the equivalent of: foo = [] foo << "bar" foo << "baz" I don't want …

lua lua-table
How to remove a lua table entry by its key?

I have a lua table that I use as a hashmap, ie with string keys : local map = { foo = 1, bar = 2 } I …

lua key lua-table
Check if array contains specific value

I have this array, with some values (int) and I want to check if a value given by the user …

lua lua-table
Most efficient way to determine if a Lua table is empty (contains no entries)?

What's the most efficient way to determine if a table is empty (that is, currently contains neither array-style values nor …

lua lua-table
How do you copy a Lua table by value?

Recently I wrote a bit of Lua code something like: local a = {} for i = 1, n do local copy = a -- …

lua lua-table
Lua - merge tables?

I need to merge two tables, with the contents of the second overwriting contents in the first if a given …

merge lua lua-table
Concatenation of tables in Lua

ORIGINAL POST Given that there is no built in function in Lua, I am in search of a function that …

lua concatenation lua-table