I load the body of a function from a string (with C api), but by default, all arguments passed to the function are accessed with .... What is the best way to specify an argument list? I can only think of prepending a line like the following to the string before parsing it (assume the arguments should be self, x, y):
local self, x, y = ...
However, I'm not sure if its the best way to do this, or whether it has any unintended side effects.
Update: in one of the functions, I need an argument list of the form self, type, .... The following wouldn't work, right?
local self, type, ... = ...
Should I use this instead?
text = "return function(self, type, ...)" + text + " end";
luaL_loadbufferx(L, text, text.length(), filename, "t");
lua_call(L, 0, 1);