lua-users home
lua-l archive

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


On 10/29/2013 03:10 PM, Bob Schiavo wrote:

Hello everybody

I’m a beginner of Lua, and I was wondering, looking at the use of Lua in environment with and without operating system, the following questions:

 

Usage of Lua with SO

1.       Is it possible to embed Lua into uCLinux, or some other RTOSs (i.e freeRTOS)?

2.       If yes, is Lua embeddable “as it is” (I don’t think so) or it needs a porting, and how the porting can be done (is there some document/user guide that describes how to do that for the two SO above)?

 

(...)

 

b)      I try to explain in poor words what I’m evaluating, so I might not be so clear as I would be.

Assuming to have a scheduler that executes sequentially a script Lua (appl_script) and some other C functions, totally independent by the execution of the lua script. Something like the following (just a logical representation of the scheduler):

While(true)

{

               Execution of lua app_script();

               Execution of C_function1();

               …

               Execution of C_functionN();

}

If the lua script itself has a while(true), the others functions will never be executed.

Is there the possibility, in a such situation, to interrupt the execution of the lua script, passing the control to the other functions of the scheduler, and resume the script next time it will be executed from the point it left off?

 

Hi
porting Lua to embedded devices and even microcontrollers is possible. What you need to care of is a memory allocation.

A scheduler that does what you want is actually possible, you can use resume and yield for this kind of scheduler. I will actually talk exactly about this in my speech at the Lua workshop.
--
Thomas