If the last parameter for your function ... (called the vararg function), the Lua interpreter puts any additional arguments in ... You can convert it to a table using {...} and copy the keys / values ββto your global table called myTable . Here is what your function looks like:
function b(...) for k, v in pairs({...}) do myTable[k] = v end end b(1, 2) -- {[1] = 1, [2] = 2} is added to myTable
You must customize the function depending on whether you want to replace, merge, or add items to myTable .
source share