table[key][subkey]table.subkey[key]table[key]table.get(subkey)table1 = {table2}table1 = table2table1 = table2[0]table1 = table2()table[1][2]?
table[1][2] = valuetable[1] = value[2]table[2][1] = valuetable[1][2].value = valuetable[1][1] when the first table is empty?
nilfor loop in Lua?
for loopsfor loops do not support nested tablespairs() function onlytable.insert()table.push()table.add()table.append()table.remove()table.delete()table.pop()table.drop()table.sort() in Lua?
table.concat() in Lua?
#tabletable.length()table.size()table.count()table.insert(table, 1, value)table.push(value)table.addFirst(value)table.unshift(value)table.remove()?
niltable.sort() do when passed a custom comparison function?
table.concat()table.join()table.merge()table.mergeBy()table.clear()table.removeAll()table = {}table.empty()key = valuevalue = keykey -> valuevalue -> keytable[key]table.getValue(key)table:retrieve(key)table.access(key)nilfalse0table.keys()pairs()table.getKeys()table.indexes()nilfalse0undefinedif table[key] thenif key in table thenif table.has(key)if table.contains(key)table.insert() to add a key-value pair to a table?
table.insert() is for arrays onlytable.insert() can insert key-value pairstable.add() insteadtable[key] = niltable.remove(key)table.delete(key)table.removeValue(key)| Qno | Answer |
|---|---|
| 1 | a) A table that contains another table as its element |
| 2 | a) table[key][subkey] |
| 3 | a) Yes, tables can contain other tables |
| 4 | a) table1 = {table2} |
| 5 | a) The value at the first index of the first table and the second index of the second table |
| 6 | a) table[1][2] = value |
| 7 | a) Yes, Lua supports tables as both keys and values |
| 8 | b) Yes, Lua tables can have other tables as keys |
| 9 | a) Returns nil |
| 10 | a) Yes, using nested for loops |
| 11 | a) table.insert() |
| 12 | a) table.remove() |
| 13 | a) Sorts the elements of the table in ascending order |
| 14 | a) Joins elements of a table into a single string |
| 15 | a) #table |
| 16 | a) table.insert(table, 1, value) |
| 17 | a) Returns nil |
| 18 | a) Sorts the table using the custom function’s logic |
| 19 | a) table.concat() |
| 20 | c) table = {} |
| 21 | a) key = value |
| 22 | a) table[key] |
| 23 | a) Returns nil |
| 24 | a) Yes, by assigning a new value to the key |
| 25 | b) pairs() |
| 26 | a) nil |
| 27 | a) Yes, tables can have duplicate keys |
| 28 | a) if table[key] then |
| 29 | a) No, table.insert() is for arrays only |
| 30 | a) table[key] = nil |