[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: newbie: parameterised scripts?
- From: Paul Dixon <pauld@...>
- Date: Mon, 6 Apr 1998 17:28:28 +0100
(I hope newbie questions are OK.....)
The way I would like to use Lua is to have a script that just contains functions, and have my controlling application (with is Windows GUI based) invoke those functions in response outside events.
One way to do this would be to load a script into memory and append the required function call to it, then pass it to lua_dostring (although it looks like lua_dostring was only indented for small scripts - my test app had to save the altered script to a temp file and use lua_dofile).
Another way would be set some global variables before calling the script, such that the 'body' of the script read the variables and called the appropriate function.
Are there other ways? After a call to lua_dofile on a script with no body, can I use lua_callfunction to select the desired function?
If anyone else is using Lua in a similar way, I'd love to hear what technique is preferable and why.
Thanks in advance,
Paul Dixon