lua-users home
lua-l archive

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

On Thu, Jun 7, 2012 at 4:04 PM, John Dunn <> wrote:
> Any other suggestions/comments on what I'm trying to do?

a different idea:  keep your current C code and write a 'coroutine
caller' in Lua.

a user could write something like this:

app.add_code (function (api)
   api.move_to (start position)
   local face = 'happy'
   api.draw (face)
   api.wait (60)
   local face = 'wink'
   api.draw (face)

where add_code creates a coroutine with the given function, and calls
it with an 'api' object that encapsulates a reference to the
coroutine, and methods that manage the spaghetinnes with callbacks
that know the coroutine to resume.