[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: loadstring to create a function with parameters
- From: Terisquas Brothers <terisquas@...>
- Date: Sun, 17 Dec 2006 13:18:16 +0000 (GMT)
I have this code:
function funcXY(param) print (param); end;
This function is used in a coroutine which receives
some parameters. Sometimes I have to restart a
coroutine, however the file has probably been modified
and reloaded, so I can't store the function funcXY "as
is", so I have to its name "funcXY"
my idea would be doing something like
funcName="funcXY";
loadstring (funcName.."()"); --<-- this would be the
function to be called, with a parameter
however loadstring expands this to:
function () funcXY(); end;
where no parameters can be passed to funcXY
Is there any way to convert the string funcName to a
function which accepts a single parameter?
TIA
Kak
___________________________________________________________
Try the all-new Yahoo! Mail. "The New Version is radically easier to use" ? The Wall Street Journal
http://uk.docs.yahoo.com/nowyoucan.html