[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: How do you implement Lua event handlers in your game?
- From: "Ashwin Hirschi" <deery@...>
- Date: Tue, 10 Apr 2007 19:52:16 +0200
> case WM_TIMER:
> lua_getglobal(L, "OnTimer");
> ... check error
>
> lua_pushnumber(L, wParam);`
>
> lua_call(L, 1, 0);
>
> break;
>
>
> The problem here it's the performance of the lua_getglobal function, if I use it to implement event handlers to actors (will have many of them), too.
Jose, there really is no problem with performance here.
We've done this wiring of Lua handlers to Windows messages for years (and on very old hardware, too). Never had any problems whatsoever.
So, your particular scenario will work just fine. Don't hold back for fear of lack of speed, and just go for it!
Ashwin.
P.S. Of course, if you can come up with something that'll work faster... hey, that's okay too [;-)].
--
no signature is a signature.