Tables as Data Structures
Unpack Values
table.unpack returns sequence values as separate results.
Unpack Values
unpack_values.lua
local secondValue =
local first, second = table.unpack({"left", secondValue})
local summary = first .. ":" .. second
print("secondValue=" .. secondValue)
print("summary=" .. summary)
local secondValue =
local first, second = table.unpack({"left", secondValue})
local summary = first .. ":" .. second
print("secondValue=" .. secondValue)
print("summary=" .. summary)
local secondValue =
local first, second = table.unpack({"left", secondValue})
local summary = first .. ":" .. second
print("secondValue=" .. secondValue)
print("summary=" .. summary)
split into names
Unpacking assigns positions from a table to separate local variables.