[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  Lua
. . -> [Subject]  How to add Lua scripting to SMAUG
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

How to add Lua scripting to SMAUG

It is now over 60 days since the last post. This thread is closed.   [New subject]  Start a new subject   [Refresh] Refresh page


Pages: 1  2  3  4 5  6  

Posted by Darwin   USA  (125 posts)  [Biography] bio
Date Reply #45 on Sat 28 Jul 2007 12:52 AM (UTC)  quote  ]

Amended on Sat 28 Jul 2007 12:57 AM (UTC) by Darwin

Message
I've copied all these into the src directory: lauxlib.h, luaconf.h, lua.h and lualib.h which were noted as being needed for development.

As for the first errors, those were actually the first errors. Everything else compiled with no warnings or errors.

These are the errors that first appear
lua_scripting.c: In function `L_mob_info':
lua_scripting.c:1016: warning: passing arg 2 of `lua_pushstring' from incompatible pointer type
gcc -c  -O -g3 -Wall -Wuninitialized    -DSMAUG  -DTIMEFORMAT   lua_bits.c
gcc -c  -O -g3 -Wall -Wuninitialized    -DSMAUG  -DTIMEFORMAT   mt19937ar.c
gcc -c  -O -g3 -Wall -Wuninitialized    -DSMAUG  -DTIMEFORMAT   lua_tables.c
distcc[30706] ERROR: compile /tmp/darwin/lua_tables.tmp.nymph.mudmagic.com.30698.i on localhost failed
lua_tables.c:79: `AT_BLACK_BLINK' undeclared here (not in a function)
lua_tables.c:79: initializer element is not constant
lua_tables.c:79: (near initialization for `at_colours_table[34].val')
lua_tables.c:79: initializer element is not constant
lua_tables.c:79: (near initialization for `at_colours_table[34]')
lua_tables.c:79: initializer element is not constant
lua_tables.c:79: (near initialization for `at_colours_table[35]')
lua_tables.c:80: `AT_BLOOD_BLINK' undeclared here (not in a function)
and continue on until finally ending with:
lua_tables.c:159: initializer element is not constant
lua_tables.c:159: (near initialization for `object_types_table[64]')
lua_tables.c:161: initializer element is not constant
lua_tables.c:161: (near initialization for `object_types_table[65]')
make[1]: *** [lua_tables.o] Error 1


Ideas?
[Go to top] top

Posted by Darwin   USA  (125 posts)  [Biography] bio
Date Reply #46 on Sat 28 Jul 2007 01:47 AM (UTC)  quote  ]

Amended on Sat 28 Jul 2007 02:06 AM (UTC) by Darwin

Message
Eh, warnings caused by differences in item and color tables. Got those fixed. Now I'm getting errors from the .o files.
lua_scripting.o(.text+0x5a): In function `optboolean':
lua_scripting.c:84: undefined reference to `luaL_checknumber'
lua_scripting.o(.text+0x8e): In function `check_vnum':
lua_scripting.c:90: undefined reference to `luaL_checknumber'
lua_scripting.o(.text+0xc5):lua_scripting.c:92: undefined reference to `luaL_error'
lua_scripting.o(.text+0xee): In function `make_char_ud':
lua_scripting.c:101: undefined reference to `luaL_error'
lua_scripting.o(.text+0x10e):lua_scripting.c:104: undefined reference to `lua_getfield'


I've no idea how to fix this.

edit: Just for clarification, these are not the only errors I get. I get similar errors from the other lua_ .o files. There's many more from the lua_scripting.o but these are few enough to list here:
lua_bits.o(.text+0xe): In function `bit_bnot':
lua_bits.c:47: undefined reference to `luaL_checknumber'
lua_bits.o(.text+0x6a): In function `bit_band':
lua_bits.c:48: undefined reference to `luaL_checknumber'
lua_bits.o(.text+0xa6):lua_bits.c:48: undefined reference to `luaL_checknumber'
lua_bits.o(.text+0x11d): In function `bit_bor':
lua_bits.c:49: undefined reference to `luaL_checknumber'
lua_bits.o(.text+0x159):lua_bits.c:49: more undefined references to `luaL_checknumber' follow
lua_bits.o(.text+0x48d): In function `bit_tonumber':
lua_bits.c:62: undefined reference to `luaL_optinteger'
lua_bits.o(.text+0x49f):lua_bits.c:65: undefined reference to `luaL_checklstring'
lua_bits.o(.text+0x4cf):lua_bits.c:73: undefined reference to `luaL_argerror'
lua_bits.o(.text+0x55d):lua_bits.c:97: undefined reference to `luaL_error'
lua_bits.o(.text+0x5c3):lua_bits.c:107: undefined reference to `luaL_error'
lua_bits.o(.text+0x645): In function `luaopen_bits':
lua_bits.c:138: undefined reference to `luaL_register'
lua_tables.o(.text+0x11): In function `MakeFlagsTable':
lua_tables.c:48: undefined reference to `lua_createtable'
lua_tables.o(.text+0x5d):lua_tables.c:54: undefined reference to `lua_setfield'
collect2: ld returned 1 exit status
distcc[15165] ERROR: compile (null) on localhost failed
make[1]: *** [smaug] Error 1
[Go to top] top

Posted by Nick Gammon   Australia  (19,631 posts)  [Biography] bio   Forum Administrator
Date Reply #47 on Sat 28 Jul 2007 02:41 AM (UTC)  quote  ]
Message
Are you compiling this under OS/X? If so, I might try that myself and see what happens.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Darwin   USA  (125 posts)  [Biography] bio
Date Reply #48 on Sat 28 Jul 2007 02:50 AM (UTC)  quote  ]
Message
I think it was mostly a linking problem. I added the liblua.a file to the L_FLAGS and it removed most of the errors as it was compiled. However, I'm still recieving these errors:

gcc -c  -O -g3 -Wall -Wuninitialized    -DSMAUG  -DTIMEFORMAT   lua_scripting.c
lua_scripting.c: In function `L_mob_info':
lua_scripting.c:1016: warning: passing arg 2 of `lua_pushstring' from incompatible pointer type

And these related to the .o files:
lua/lib/liblua.a(loadlib.o)(.text+0x19): In function `ll_load':
: undefined reference to `dlopen'
lua/lib/liblua.a(loadlib.o)(.text+0x31): In function `ll_load':
: undefined reference to `dlerror'
lua/lib/liblua.a(loadlib.o)(.text+0x56): In function `ll_sym':
: undefined reference to `dlsym'
lua/lib/liblua.a(loadlib.o)(.text+0x6e): In function `ll_sym':
: undefined reference to `dlerror'
lua/lib/liblua.a(loadlib.o)(.text+0x5): In function `ll_unloadlib':
: undefined reference to `dlclose'
collect2: ld returned 1 exit status
distcc[1517] ERROR: compile (null) on localhost failed
make[1]: *** [smaug] Error 1


I'm compiling under a version of Linux. So far, this is the least amount, and the complete list, of errors that I receive while trying to compile.
[Go to top] top

Posted by Nick Gammon   Australia  (19,631 posts)  [Biography] bio   Forum Administrator
Date Reply #49 on Sat 28 Jul 2007 03:06 AM (UTC)  quote  ]
Message
I think I got those messages about `ll_load' until I had -ldl in my Makefile. In other words, in Makefile:


#Comment it out if you get errors about ldl not being found.
NEED_DL = -ldl


Note the line is not commented out.

As for this:

lua_scripting.c:1016: warning: passing arg 2 of `lua_pushstring' from incompatible pointer type



Can you show me what line 1016 in lua_scripting.c is? I have changed my copy, and it is not at the same place.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Darwin   USA  (125 posts)  [Biography] bio
Date Reply #50 on Sat 28 Jul 2007 03:18 AM (UTC)  quote  ]
Message
Awesome. Adding
#Comment it out if you get errors about ldl not being found.
NEED_DL = -ldl
to the Makefile fixed that problem. It finally compiled with only that one warning.

As for what that warning is:
lua_scripting.c:1016:
  MOB_STR_ITEM (spec_fun);

Changed from
  MOB_STR_ITEM (spec_funname);
due to that being what it's called in my source.

Related stuffs that might be nice to know:
in mud.h
typedef bool	SPEC_FUN	args( ( CHAR_DATA *ch ) );

struct	mob_index_data
{
    MOB_INDEX_DATA *	next;
    MOB_INDEX_DATA *	next_sort;
    SPEC_FUN *		spec_fun;
...
};
[Go to top] top

Posted by Nick Gammon   Australia  (19,631 posts)  [Biography] bio   Forum Administrator
Date Reply #51 on Sat 28 Jul 2007 03:25 AM (UTC)  quote  ]
Message
Great. You could always omit lines like that. I just means it won't put "spec_fun" into the table returned by mob_info. Probably no big deal.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Darwin   USA  (125 posts)  [Biography] bio
Date Reply #52 on Sat 28 Jul 2007 03:56 AM (UTC)  quote  ]
Message
Good and bad news.
Good news: It compiles just fine. No errors, no warnings.

Bad news: MUD crashes as soon as I log in.
[Go to top] top

Posted by Nick Gammon   Australia  (19,631 posts)  [Biography] bio   Forum Administrator
Date Reply #53 on Sat 28 Jul 2007 04:08 AM (UTC)  quote  ]
Message
Try doing a "make clean" and then "make", just in case.

If that doesn't help, time to use gdb. Some of your "tweaks" may have changed the sense of things.

Change to the area directory, then:

gdb ../src/smaug

Then type "run" and after it starts up, log in. When it crashes type "bt" into the gdb window, and post the results.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Darwin   USA  (125 posts)  [Biography] bio
Date Reply #54 on Sat 28 Jul 2007 04:11 AM (UTC)  quote  ]

Amended on Sat 28 Jul 2007 04:16 AM (UTC) by Darwin

Message
I have a habit of always doing make clean before actually compiling.

I did as you suggested and when it crashed, bt gave this:
Program received signal SIGSEGV, Segmentation fault.
luaG_typeerror (L=0xa37df60, o=0xa3e4e1c, op=0x41cda4 "call") at ldebug.c:517
517     ldebug.c: No such file or directory.
        in ldebug.c
(gdb) bt
#0  luaG_typeerror (L=0xa37df60, o=0xa3e4e1c, op=0x41cda4 "call") at ldebug.c:517
#1  0x004116fc in tryfuncTM (L=0xa37df60, func=0xa3e4e1c) at ldo.c:211
#2  0x004117aa in luaD_precall (L=0xa37df60, func=0xa3e4e1c) at ldo.c:225
#3  0x00411abf in luaD_call (L=0xa37df60, func=0xa3e4e1c, nResults=0) at ldo.c:311
#4  0x081709bd in lua_call ()
#5  0x0817461e in luaL_openlibs ()
#6  0x0816e7db in open_lua (ch=0xa37df60) at lua_scripting.c:2484
#7  0x080a6b0c in nanny (d=0xa379fc0, argument=0xbfffbb70 "******") at comm.c:1827
#8  0x080a5030 in game_loop () at comm.c:723
#9  0x080a47df in main (argc=2, argv=0xbfffc390) at comm.c:318
[Go to top] top

Posted by Nick Gammon   Australia  (19,631 posts)  [Biography] bio   Forum Administrator
Date Reply #55 on Sat 28 Jul 2007 04:30 AM (UTC)  quote  ]
Message
Strange it should crash when opening Lua. I am wondering if, with all the mucking around with .h files and everything, you have got the Lua 5.0 and Lua 5.1 intermixed somehow.

Make sure that the .h files are all copied from the Lua 5.1 distribution, and that the liblua.a file is also from when you built it.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Darwin   USA  (125 posts)  [Biography] bio
Date Reply #56 on Sat 28 Jul 2007 04:36 AM (UTC)  quote  ]
Message
I did that. The link to the liblua.a file uses an absolute path to where I installed the 5.1.2 version. I also went into the include directory and copied all the required .h files into my src directory. The only other thing that I can think of is that the server installed version is messing with the version I installed.

Thoughts?
[Go to top] top

Posted by Nick Gammon   Australia  (19,631 posts)  [Biography] bio   Forum Administrator
Date Reply #57 on Sat 28 Jul 2007 04:49 AM (UTC)  quote  ]
Message
I can't see what is wrong if you did as you described. Perhaps change to the lua source directory (which is /home/nick/lua-5.1.1/src in my case) and try typing:


./lua


That should at least fire up your local copy of Lua. See if you get this message:


Lua 5.1.1  Copyright (C) 1994-2006 Lua.org, PUC-Rio
>


That at least confirms Lua is operational. I can't help much more than that, unless you want to send me a message through the forum mail, giving me a login and password for your shell account so I can try various things for myself. I will understand if you don't want to. If you do, I suggest changing the password temporarily to something new, let me try to fix it for an hour, and change it back. Better also give me the IP address of the server.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Darwin   USA  (125 posts)  [Biography] bio
Date Reply #58 on Sat 28 Jul 2007 04:54 AM (UTC)  quote  ]
Message
$ ./lua
Lua 5.1.2 Copyright (C) 1994-2007 Lua.org, PUC-Rio

I'll send you the info via email in a moment.
[Go to top] top

Posted by Nick Gammon   Australia  (19,631 posts)  [Biography] bio   Forum Administrator
Date Reply #59 on Sat 28 Jul 2007 05:32 AM (UTC)  quote  ]

Amended on Sat 28 Jul 2007 05:35 AM (UTC) by Nick Gammon

Message
OK we worked it out. In case anyone is wondering, this is how a line in the Makefile looked:


L_FLAGS = $(OPT_FLAG) $(PROF) $(SOLARIS_LINK) $(NEED_DL) $(NEED_CRYPT) ~/lua/lib/liblua.a -llua -lm


However that was effectively linking against both versions of Lua. I simply removed the Lua 5.0 version, like this:


L_FLAGS = $(OPT_FLAG) $(PROF) $(SOLARIS_LINK) $(NEED_DL) $(NEED_CRYPT) ~/lua/lib/liblua.a -lm


Then it worked OK.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] 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.


49,214 views.

This is page 4, subject is 6 pages long:  [Previous page]  1  2  3  4 5  6  [Next page]

It is now over 60 days since the last post. This thread is closed.   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Web site powered by FutureQuest.Net]