lua-users home
lua-l archive

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


hello all,
    i'm looking for a way to implement pre-emptive threading of multiple
lua scripts simultaneously in lua 5.... eg., given two lua scripts:

io.write("Hello world, FOO from ",_VERSION,"!\n")
io.write("Hello world, FOO from ",_VERSION,"!\n")
io.write("Hello world, FOO from ",_VERSION,"!\n")

and

io.write("Hello world, BAR from ",_VERSION,"!\n")
io.write("Hello world, BAR from ",_VERSION,"!\n")
io.write("Hello world, BAR from ",_VERSION,"!\n")

it'd be great to be able to execute a command of the nature:

$ lua5 hello.lua hello2.lua

and receive the output:

Hello world, FOO from _VERSION,!
Hello world, BAR from _VERSION,!
Hello world, FOO from _VERSION,!
Hello world, BAR from _VERSION,!
Hello world, FOO from _VERSION,!
Hello world, BAR from _VERSION,!

Someone mentioned there is a way to do this from C API. I would not like
to use coroutines. Interestingly enough, I've started to attempt to
accomplish this by modifying Lua 5 accordingly, but things are not going
too well :-) Anyone have any pointers?

-Ryan Bastic