Posted 19 April 2013 - 08:38 AM
Hey guys,
Is there any way to call a function using a table for arguments? The number of arguments can change depending on user input. For example, if a table is set up as { "edit", "myFile" }, I want to call shell.run() with the table values as the arguments. Another example: the table is { "myFile", "arg1", "arg2", "arg3" }. I would need to call shell.run("myFile", "arg1", "arg2", "arg3"). Since the number of arguments needed can change, hardcoding
Is there any way to call a function using a table for arguments? The number of arguments can change depending on user input. For example, if a table is set up as { "edit", "myFile" }, I want to call shell.run() with the table values as the arguments. Another example: the table is { "myFile", "arg1", "arg2", "arg3" }. I would need to call shell.run("myFile", "arg1", "arg2", "arg3"). Since the number of arguments needed can change, hardcoding
local var1 = myTable[1]
local var2 = myTable[2]
and so on wouldn't be efficient. How can I do this?