21 Dec, 2006, Pedlar wrote in the 1st comment:
Votes: 0
Hello, I use Lua 5.1.1 in my mud, ive used it for quite sometime now, but im sick of everything geting spit out at once, ive been working on this for quite some time as well, and im out of thoughts.

see what i want is something like
Lua Code:
send_char("Hey, This is the first message.", _ch)
wait(3)
send_char("This is the second message, 3 seconds after the first.", _ch)


ive tried lua_yield and lua_resume, but i jus get big crashes.
Lua Wait function:
static int lm_timer(lua_State *l) {
int ticks = (int)lua_tonumber(l, 1);

AddEvent(l, ticks);

return lua_yield(l, 0);
}

The Resume function is called from a timer:
void LuaEvent::Call() {
if(this == NULL)
return;

log_string("Calling Resume");


if (lua_resume(state, 0) != 0)
log_string("Error resuming");


return;
}

I recieve the Calling Resume, and then boom.
heres the crash log too…jus for fun…
Quote
Program received signal SIGABRT, Aborted.
0x403bbd81 in kill () from /lib/libc.so.6
(gdb) bt
#0 0x403bbd81 in kill () from /lib/libc.so.6
#1 0x403bbb05 in raise () from /lib/libc.so.6
#2 0x403bd05d in abort () from /lib/libc.so.6
#3 0x403ee46c in __libc_message () from /lib/libc.so.6
#4 0x403f6df6 in malloc_printerr () from /lib/libc.so.6
#5 0x403f5e7a in malloc_consolidate () from /lib/libc.so.6
#6 0x403f5493 in _int_malloc () from /lib/libc.so.6
#7 0x403f60a5 in _int_realloc () from /lib/libc.so.6
#8 0x403f483e in realloc () from /lib/libc.so.6
#9 0x08101472 in luaM_realloc_ ()
#10 0x080fe86d in luaD_reallocstack ()
#11 0x080ff28b in resume_error ()
#12 0x080f7252 in LuaEvent::Call (this=0x849efa8) at lua.c:117
#13 0x080f70e2 in EventUpdate () at lua.c:57
#14 0x080bc547 in update_handler () at update.c:1935
#15 0x08086be4 in game_loop_unix (control=5) at comm.c:934
#16 0x080866ac in main (argc=5, argv=0xbfffdf90) at comm.c:476
(gdb) frame 12
#12 0x080f7252 in LuaEvent::Call (this=0x849efa8) at lua.c:117
117 if (lua_resume(state, 0) != 0)
Current language: auto; currently c++


Thanks for any help that you all can give.
21 Dec, 2006, Omega wrote in the 2nd comment:
Votes: 0
info the locals and print the data
0.0/2