lua-users home
lua-l archive

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


>> I'm the other guy behind Lua Alchemy.

> Hello! Thank you for your work.

You're welcome! I'm glad you appreciate it.

> What I really would like to be able to try is a program where a hosted Lua
> script uses coroutines in a simplistic way that demonstrates a Lua function
> suspending itself until later. For example, this:

>   player:say("I shouldn't have eaten that.")
>   player:move_to(300,200)
>   player:say("I don't feel too good.")
>   player:animate("die")

> ...as a Lua script for some kind of (morbid) Flash adventure game. Each of
> these methods on the "player" (a Lua object, here, rather than a proxy to an
> ActionScript object) may internally use coroutine.yield() many times in
> order to "sleep" until the next step of the game (when the Flash
> application's timer event next fires).

I believe this is orthogonal to the backend (Lua Alchemy or no Lua
Alchemy) -- as long as backend is capable to call "tick" callbacks in
Lua. Such ticks can be trivially converted to the calls to
coroutine.resume().

It is only the matter of thickness of game logic wrapper. Looks like
such wrapper is outside of Lua Alchemy library scope.

Alexander.