[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Globals as Locals?
- From: "David Holz" <davidh@...>
- Date: Fri, 21 Mar 2003 19:27:18 -0800
From: "Nick Davies" <goodbytes@binarysurge.com>
> Greetings! I'm using Lua in a game project, so, naturally, I'm worried
about
> speed of execution.
I'm dealing with the same sort of issues in my project. What you need to do
for any interpreted language is to have the scripts set up the room, set up
what triggers are in the room, and which Lua script to call for each trigger
event. C/C++ should run everything until a trigger occurs (C/C++ does all
the trigger checking), then calls Lua only when something actually happened.
In the case of keyboard input, instead of having Lua poll for an input key,
have C/C++ do it, and notify Lua if a key is pressed (or released). The Lua
script should update the values which C/C++ draws to the screen every frame.
If the text onscreen is static, Lua shouldn't need to be called every frame.
It does take a bit of groundwork to allow code to work like this, but it
maximizes efficiency.