[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: lua stack from 'C' loop to lua
- From: "Dr Christopher S Kirk" <drcskirk@...>
- Date: Thu, 26 Feb 2009 16:35:50 +0000
Subject: using lua to call a continuous 'C' function and passing data
back to lua without terminating the 'C' loop
I am attempting the use of lua calling 'C' functions from a 'C' library.
All 'C' functions are self-contained in a library but one is a loop (do
forever). This function waits for input from a networked source and
produces five variables.
If this function were to be called from lua only once and then to result
in termination, it would be reasonable for 'C' to pass the variables to
the lua_stack and 'return' the number of 'pushed' variables (5) as it
However, this case is continuous, (it is a loop) so is it possible to
push variables to the stack and to 'return' the number (5) and to have
lua poll for results to enable further manipulation yet maintain the
loop within 'C'? How would lua 'know' of the update?
Is the only route to terminate the 'C' loop, return the results and have
lua restart the loop?
I would appreciate pointers or direct advice.
Many thanks for considering the problem.
http://www.fastmail.fm - Email service worth paying for. Try it for free