what does this actually do and how does this work? This is the first time I have ever come across something like this, and the tutorial above doesn’t really explain it.
However, the top one is much easier to read. The false and table.unpack call are passing parameters to the function, so let me go over that:
local inputs = {
[1] = Enum.KeyCode.E;
[2] = Enum.KeyCode.F;
}
contextActionService:BindAction("ActionName", function()
end,
false, -- This specifies if it should create a touch button for touch controls
table.unpack(inputs)) -- This unpacks a table to use as inputs, typically Keycodes.
When it comes to table.unpack, this:
function printVaradic(...)
for i,v in pairs({...}) do
print(v)
end
end
local t = {
[1] = Enum.KeyCode.E;
[2] = Enum.KeyCode.F;
}
printVaradic(table.unpack(t))
is the same as this:
function printVaradic(...)
for i,v in pairs({...}) do
print(v)
end
end
printVaradic(Enum.KeyCode.E, Enum.KeyCode.F)