 |
intoK Apprentice
Joined: 18 Feb 2007 Posts: 190
|
Posted: Sun Oct 26, 2008 11:19 pm
[2.36 lua] zs.waitsignal |
well, understandably waitsignal wont take branch arguments from lua,
but it would be quite simple to implement to have it return true/false depending whether it got signal or not and realize branching from lua, no?
as it is, waitsignal from lua works like wait with interrupt option, btw. it also dosnt clears signal flag |
|
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Oct 27, 2008 4:51 pm |
There really isn't any good way to do this. Lua has it's own threading model. Mixing Lua with the CMUD threading model is pretty undefined at the moment. I probably shouldn't even let you call stuff like "waitsignal" from Lua.
#WAITSIGNAL is a command in CMUD. It is not a function and therefore doesn't return any results. In Lua, everything is a function. But calling zs.command where "command" is a #command in CMUD isn't going to return anything. |
|
|
|
 |
intoK Apprentice
Joined: 18 Feb 2007 Posts: 190
|
Posted: Mon Oct 27, 2008 4:59 pm |
idk, you did very nice job with mt engine and lua's mt support wo any extensions is quite limited - would be nice to have it combined somehow 
|
|
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Mon Oct 27, 2008 5:06 pm |
You could try using the #lua command to call routines before and after a #waitsignal.
|
|
|
|
 |
intoK Apprentice
Joined: 18 Feb 2007 Posts: 190
|
Posted: Mon Oct 27, 2008 5:14 pm |
yeah, i thank of that but its just nasty to write containers in zscript for lua procs just to use cmuds threading...
another option would be using ltask library and rebuilding whole mt system with it, but taht complicates stuff even more |
|
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Oct 28, 2008 4:00 pm |
You just need to create some aliases that are called by the #WAITSIGNAL. Have a normal zScript that calls #WAITSIGNAL and then executes an alias for the true/false case. Then make each of those aliases a Lua script.
That's the only way to do it right now. Multithreading is very complex and can cause huge stability problems and I'm not going to be messing around with it for a long time now. Too many other high-priority tasks to get done that will benefit more people. Especially since it's not preventing you from really doing anything. There's no reason to try and completely avoid zscript. |
|
|
|
 |
intoK Apprentice
Joined: 18 Feb 2007 Posts: 190
|
Posted: Tue Oct 28, 2008 4:51 pm |
right-o, ill figure something out, thanks for the tip
absolutely, mapper and then db should be top prio  |
|
|
|
 |
|
|
|