Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ Lua ➜ Problem with lua in 1.9

Problem with lua in 1.9

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Orik   USA  (182 posts)  Bio
Date Fri 27 Mar 2009 01:52 AM (UTC)
Message
I just added lua into 1.9 and get a crash on add_kill.

Tried killing Chadoyn and got this:

Program received signal SIGSEGV, Segmentation fault.
0x08253495 in luaS_newlstr ()
Current language:  auto; currently asm
(gdb) list
384     }  /* cleanup memory */
385
386     #ifdef WIN32
387     int mainthread( int argc, char **argv )
388     #else
389     int main( int argc, char **argv )
390     #endif
391     {
392        struct timeval now_time;
393        bool fCopyOver = FALSE;
(gdb) bt
#0  0x08253495 in luaS_newlstr ()
#1  0x0824af1e in lua_getfield ()
#2  0x0824036e in find_mud_lua_function (fname=0x829b491 "killed_mob") at lua_scripting.c:2719
#3  0x08244a27 in call_mud_lua_char_num (fname=0x829b491 "killed_mob", str=0x8603910 "George", num=10345)
    at lua_scripting.c:2787
#4  0x081773d5 in add_kill (ch=0x860b378, mob=0x8598c20) at handler.c:5111
#5  0x0816f80a in damage (ch=0x860b378, victim=0x8598c20, dam=18, dt=1003) at fight.c:2343
#6  0x08171a08 in one_hit (ch=0x860b378, victim=0x8598c20, dt=1003) at fight.c:1334
#7  0x081721b3 in multi_hit (ch=0x860b378, victim=0x8598c20, dt=-1) at fight.c:763
#8  0x08173971 in violence_update () at fight.c:387
#9  0x0822f43b in update_handler () at update.c:2095
#10 0x0813c496 in game_loop () at comm.c:879
#11 0x0813e4b0 in main (argc=2, argv=0xbfa3cac4) at comm.c:529
(gdb) frame 0
#0  0x08253495 in luaS_newlstr ()
(gdb) list
394     #ifdef IMC
395        int imcsocket = -1;
396     #endif
397
398        DONT_UPPER = FALSE;
399        num_descriptors = 0;
400        first_descriptor = NULL;
401        last_descriptor = NULL;
402        sysdata.NO_NAME_RESOLVING = TRUE;
403        sysdata.WAIT_FOR_AUTH = TRUE;
(gdb) frame 2
#2  0x0824036e in find_mud_lua_function (fname=0x829b491 "killed_mob") at lua_scripting.c:2719
2719      lua_getglobal (L_mud, fname);
Current language:  auto; currently c++
(gdb) print fname
$1 = 0x829b491 "killed_mob"


See anything in there?
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #1 on Fri 27 Mar 2009 03:01 AM (UTC)
Message
How did you add Lua, exactly?

It looks like it is crashing on looking up the function killed_mob in global script space. Next time, can you print L_mud? Maybe it is not set up for some reason. Or, it got corrupted.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Orik   USA  (182 posts)  Bio
Date Reply #2 on Fri 27 Mar 2009 03:25 AM (UTC)
Message
I just copied the files over and added it by finding everywhere it was done in 1.8.


(gdb) print L_mud
$1 = (lua_State *) 0x0
(gdb)


There's L_mud, guess nothing is being given to it.

Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #3 on Fri 27 Mar 2009 04:06 AM (UTC)
Message
It is NULL, which means the Lua engine was never initialized. I would check the part of the code which does that.

Check where you have put the lines:


open_lua (ch);  /* fire up Lua state */


I would put a breakpoint there in gdb and see if that line is being called (probably not, I guess). If not, I would work out why not.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Orik   USA  (182 posts)  Bio
Date Reply #4 on Fri 27 Mar 2009 04:35 AM (UTC)
Message
I hadn't added:


   log_string( "Initializing Lua" );
   open_mud_lua ();  /* initialize Lua engine */


Right before the Booting Database in comm.c.


It's working now.
Top

Posted by Metsuro   USA  (389 posts)  Bio
Date Reply #5 on Wed 03 Jun 2009 06:38 AM (UTC)
Message
Did you find it easy to get lua into 1.9

Everything turns around in the end
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


22,700 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.