Hi,
I need to make … (the think i use as this
local function a (b,...)
return ...
end
).
So I can add there all parametrs for example from spliting string and then call function with all of them as single arguments.
Hi,
I need to make … (the think i use as this
local function a (b,...)
return ...
end
).
So I can add there all parametrs for example from spliting string and then call function with all of them as single arguments.
This post is very vague and lacks detail, please expand so that we can help you
I need to get parametrs from string, and idk how many i will have, so, i got idea to use … as here in the test function
function test (...)
someFunc(...)
end
test(1,2,3,4,5,6)
but idk how to create … without having it as agument.
just put your args into a table and read from the table like args[2]
I got also this idea, but i dont want to edit all functions, so i am asking, if this is possible.
BTW, i really dont understand whole …, so i will be happy when you will tell what it is.
unpack( table, [ firstIndex, lastIndex ] )
Unpacks a table into the equivalent multiple argument list and returns it. So you can do:
print(unpack({1, 4, 5})) -> 1 4 5
You can build an array from an ellipsis with
function test(...)
local args = {...}
for i, v in ipairs(args) do
print(i..": "..tostring(v))
end
end
I don’t know if that helps; you haven’t been really clear about what your problem is.