lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 16 October 2010 10:54, Brett Cameron <brett.r.cameron@gmail.com> wrote:
> Alex,
>
> Check out http://lua-users.org/wiki/LuaUses ;(and elsewhere). For instance,
> Lua is used for several games that certainly have aspects of real-time about
> them. My son is in fact ugrading one such game (World of Warcraft) as I
> type...
>
> Brett
>
>
> 2010/10/16 Alex de Magalhães <alex@lisha.ufsc.br>
>>
>> Hey everyone,
>>
>> Could anyone tell me if it's possible to make real-time applications in
>> Lua? If it's not, then why? I know that GC usually impacts RTC, but I don't
>> know if there are other sources of trouble. Has anyone tested the impact of
>> GC in real-time Lua applications, if there is any?
>>
>> Well, that's all for now. I hope to hear from you soon.
>>
>> Sincerely,
>> Alex

I was stress-testing the GC in World of Warcraft last night and it
didn’t seem to adversely affect the frame rate.

I’ve also done fairly heavy processing of MIDI data in real-time
without any latency issues. The main issue I had was if a midi message
came in when the Lua state was still busy and the stack had not been
emptied. This only happened rarely because Lua is quick and the
function normally returned well before another midi message had come
in. My solution (after teaching myself the basics of multi-threading)
was to "lock" the Lua state while it was running and have the waiting
message sleep a millisecond at a time until the function had returned
and it was safe to manipulate the stack again. This works fine. I
think the granular GC works very discretely (pun intended). As long as
you separate out your low-latency high-priority tasks and streamline
them it should be fine.

Vaughan