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.
Entire forum
➜ SMAUG
➜ Lua
➜ How to add Lua scripting to SMAUG
How to add Lua scripting to SMAUG
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Pages: 1
2
3
4 5
6
Posted by
| Darwin
USA (125 posts) Bio
|
Date
| Reply #45 on Sat 28 Jul 2007 12:52 AM (UTC) 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? | Top |
|
Posted by
| Darwin
USA (125 posts) Bio
|
Date
| Reply #46 on Sat 28 Jul 2007 01:47 AM (UTC) 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
| Top |
|
Posted by
| Nick Gammon
Australia (23,102 posts) Bio
Forum Administrator |
Date
| Reply #47 on Sat 28 Jul 2007 02:41 AM (UTC) |
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 | Top |
|
Posted by
| Darwin
USA (125 posts) Bio
|
Date
| Reply #48 on Sat 28 Jul 2007 02:50 AM (UTC) |
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. | Top |
|
Posted by
| Nick Gammon
Australia (23,102 posts) Bio
Forum Administrator |
Date
| Reply #49 on Sat 28 Jul 2007 03:06 AM (UTC) |
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 | Top |
|
Posted by
| Darwin
USA (125 posts) Bio
|
Date
| Reply #50 on Sat 28 Jul 2007 03:18 AM (UTC) |
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;
...
};
| Top |
|
Posted by
| Nick Gammon
Australia (23,102 posts) Bio
Forum Administrator |
Date
| Reply #51 on Sat 28 Jul 2007 03:25 AM (UTC) |
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 | Top |
|
Posted by
| Darwin
USA (125 posts) Bio
|
Date
| Reply #52 on Sat 28 Jul 2007 03:56 AM (UTC) |
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. | Top |
|
Posted by
| Nick Gammon
Australia (23,102 posts) Bio
Forum Administrator |
Date
| Reply #53 on Sat 28 Jul 2007 04:08 AM (UTC) |
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 | Top |
|
Posted by
| Darwin
USA (125 posts) Bio
|
Date
| Reply #54 on Sat 28 Jul 2007 04:11 AM (UTC) 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
| Top |
|
Posted by
| Nick Gammon
Australia (23,102 posts) Bio
Forum Administrator |
Date
| Reply #55 on Sat 28 Jul 2007 04:30 AM (UTC) |
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 | Top |
|
Posted by
| Darwin
USA (125 posts) Bio
|
Date
| Reply #56 on Sat 28 Jul 2007 04:36 AM (UTC) |
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? | Top |
|
Posted by
| Nick Gammon
Australia (23,102 posts) Bio
Forum Administrator |
Date
| Reply #57 on Sat 28 Jul 2007 04:49 AM (UTC) |
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 | Top |
|
Posted by
| Darwin
USA (125 posts) Bio
|
Date
| Reply #58 on Sat 28 Jul 2007 04:54 AM (UTC) |
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. | Top |
|
Posted by
| Nick Gammon
Australia (23,102 posts) Bio
Forum Administrator |
Date
| Reply #59 on Sat 28 Jul 2007 05:32 AM (UTC) 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 | 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.
243,864 views.
This is page 4, subject is 6 pages long:
1
2
3
4 5
6
It is now over 60 days since the last post. This thread is closed.
Refresh page
top