lua_call --- but which script?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

lua_call --- but which script?

Matthias Gall
Hello everyone,

I am currently trying to implement LUA into our real time strategy game. In
our map editor, the designer is able to create trigger points which, once
activated, call a LUA function in the mission script. The name of the
function to call and the function script is written by our designers. So, I
read the script, pushed function name and parameters, and tried lua_call.
The problem is, that LUA does not know it's script. Normally, I use
lua_dobuffer to execute a script, but in this case, I only want to call a
special function of a script. So, how do I tell LUA, in which script buffer
the function is located?

Thank you for any answers,
Matt

PS: Anyone knows other RTS game projects using LUA where I could take a
look? Most sites on the LUA project list seem to be dead.

--
Matthias Gall, lead programmer at sechsta sinn
http://www.sechsta-sinn.de
[hidden email]



Reply | Threaded
Open this post in threaded view
|

Re: lua_call --- but which script?

Matthias Gall
Well, the problem is solved. I have to execute the script first so that LUA
knows my functions.

Matt


Reply | Threaded
Open this post in threaded view
|

Re: lua_call --- but which script?

Erik Hougaard
In reply to this post by Matthias Gall
----- Original Message -----
> I am currently trying to implement LUA into our real time strategy game.
In
> our map editor, the designer is able to create trigger points which, once
> activated, call a LUA function in the mission script. The name of the
> function to call and the function script is written by our designers. So,
I
> read the script, pushed function name and parameters, and tried lua_call.
> The problem is, that LUA does not know it's script. Normally, I use
> lua_dobuffer to execute a script, but in this case, I only want to call a
> special function of a script. So, how do I tell LUA, in which script
buffer
> the function is located?

Well lua_call can only call function that are already in your memory space,
so one solution would be to lua_dobuffer all your script at the beginning so
they are available for you to lua_call later on.

/Erik