local function c(thing1, thing2, thing3)
print(thing1) -- Outputs: 5
print(thing2) -- Outputs: 1
print(thing3) -- Outputs: nil
end
local function b(tbl)
print(table.unpack(tbl)) -- Outputs: 5 6
c(table.unpack(tbl), 1) -- [[Noted line #1]]
end
local function a(...)
print(table.pack(...)) -- Outputs: {[1] = 5, [2] = 6, ["n"] = 2}
b(table.pack(...))
end
a(5, 6) -- [[Noted line #2]]
I’m trying to get the two arguments on noted line #2 and the one extra added argument on noted line #1 as parameters to the c function. However, thing3 keeps printing nil. How do I get the unpacked table to separate into two/amount of entries in the table different parameters?
I need three functions for this because in what I’m actually doing, each function is in a different module.