Specifying function argument names in lua -
i load body of function string (with c api), default, arguments passed function accessed ...
. best way specify argument list? can think of prepending line following string before parsing (assume arguments should self, x, y):
local self, x, y = ...
however, i'm not sure if best way this, or whether has unintended side effects.
update: in 1 of functions, need argument list of form self, type, ...
. following wouldn't work, right?
local self, type, ... = ...
should use instead?
text = "return function(self, type, ...)" + text + " end"; lual_loadbufferx(l, text, text.length(), filename, "t"); lua_call(l, 0, 1);
prepending line excellent way create named arguments. if use local declaration have, there won't side effects (except ones rest of code).
Comments
Post a Comment