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
➜ Compiling on Smaugfuss1.8
Compiling on Smaugfuss1.8
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Orik
USA (182 posts) Bio
|
Date
| Mon 16 Jul 2007 04:08 AM (UTC) |
Message
| I'm getting these errors in lua_scripting.c I'm guessing it's becuase going from C to C++ might mix it up.
Compiling o/lua_scripting.o....
lua_scripting.c: In function `int check_vnum(lua_State*)':
lua_scripting.c:88: warning: converting to `int' from `lua_Number'
lua_scripting.c: In function `ROOM_INDEX_DATA* L_find_room(lua_State*, int)':
lua_scripting.c:139: warning: converting to `int' from `lua_Number'
lua_scripting.c: In function `CHAR_DATA* L_find_character(lua_State*)':
lua_scripting.c:225: warning: converting to `int' from `lua_Number'
lua_scripting.c: In function `int L_sysdata(lua_State*)':
lua_scripting.c:535: error: 'struct system_data' has no member named 'ident_retr
ies'
lua_scripting.c: In function `int L_room_info(lua_State*)':
lua_scripting.c:1269: error: cannot convert `EXT_BV' to `lua_Number' for argumen
t `2' to `void lua_pushnumber(lua_State*, lua_Number)'
lua_scripting.c:1295: warning: comparison between signed and unsigned integer ex
pressions
lua_scripting.c: In function `int L_room_exits(lua_State*)':
lua_scripting.c:1333: warning: converting to `int' from `lua_Number'
lua_scripting.c:1347: warning: comparison between signed and unsigned integer ex
pressions
lua_scripting.c: In function `int L_set_char_color(lua_State*)':
lua_scripting.c:1366: warning: converting to `int' from `lua_Number'
lua_scripting.c: In function `int L_transfer(lua_State*)':
lua_scripting.c:1422: warning: converting to `int' from `lua_Number'
lua_scripting.c: In function `int L_gain_exp(lua_State*)':
lua_scripting.c:1475: warning: passing `lua_Number' for converting 2 of `void ga
in_exp(CHAR_DATA*, int)'
lua_scripting.c: In function `int L_gain_gold(lua_State*)':
lua_scripting.c:1483: warning: converting to `int' from `lua_Number'
lua_scripting.c: In function `int L_destroy_item(lua_State*)':
lua_scripting.c:1494: warning: converting to `int' from `lua_Number'
lua_scripting.c: In function `int L_purgeobj(lua_State*)':
lua_scripting.c:1524: warning: converting to `int' from `lua_Number'
lua_scripting.c: In function `int L_oinvoke(lua_State*)':
lua_scripting.c:1571: warning: converting to `int' from `lua_Number'
lua_scripting.c: In function `OBJ_DATA* make_one_object(lua_State*, AREA_DATA*,
int, int)':
lua_scripting.c:1607: warning: converting to `int' from `lua_Number'
lua_scripting.c: In function `OBJ_DATA* build_nested_object(lua_State*, AREA_DAT
A*, int, int)':
lua_scripting.c:1659: warning: comparison between signed and unsigned integer ex
pressions
lua_scripting.c: In function `int L_minvoke(lua_State*)':
lua_scripting.c:1694: warning: converting to `int' from `lua_Number'
lua_scripting.c:1727: warning: converting to `int' from `lua_Number'
lua_scripting.c:1768: warning: comparison between signed and unsigned integer ex
pressions
lua_scripting.c: In function `int L_randomize_exits(lua_State*)':
lua_scripting.c:1845: warning: passing `lua_Number' for converting 2 of `void ra
ndomize_exits(ROOM_INDEX_DATA*, short int)'
lua_scripting.c: In function `int L_make_trap(lua_State*)':
lua_scripting.c:1853: warning: converting to `int' from `lua_Number'
$
lua_scripting.c:1855: warning: converting to `int' from `lua_Number'
lua_scripting.c:1856: warning: converting to `int' from `lua_Number'
lua_scripting.c: In function `int L_msg_char(lua_State*)':
lua_scripting.c:2173: warning: converting to `int' from `lua_Number'
lua_scripting.c: In function `int L_msg_room(lua_State*)':
lua_scripting.c:2203: warning: converting to `int' from `lua_Number'
lua_scripting.c: In function `int L_msg_area(lua_State*)':
lua_scripting.c:2236: warning: converting to `int' from `lua_Number'
lua_scripting.c: In function `int L_msg_game(lua_State*)':
lua_scripting.c:2267: warning: converting to `int' from `lua_Number'
lua_scripting.c: In function `int L_mt_srand(lua_State*)':
lua_scripting.c:2392: warning: comparison between signed and unsigned integer ex
pressions
lua_scripting.c:2400: warning: converting to `long unsigned int' from `lua_Numbe
r'
lua_scripting.c:2407: warning: passing `lua_Number' for converting 1 of `void in
it_genrand(long unsigned int)'
lua_scripting.c: In function `int call_mud_lua_function(const char*, int)':
lua_scripting.c:2751: warning: converting to `int' from `lua_Number'
make[1]: *** [o/lua_scripting.o] Error 1
make: *** [all] Error 2
| Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #1 on Mon 16 Jul 2007 06:04 AM (UTC) |
Message
| You have 2 errors as far as I can see, the rest are warnings because I was a bit loose with doubles and ints.
Quote:
lua_scripting.c:535: error: 'struct system_data' has no member named 'ident_retries'
You must have deleted that? Just delete this line:
SYSDATA_NUM_ITEM (ident_retries); /* Number of times to retry broken pipes. */
Quote:
lua_scripting.c:1269: error: cannot convert `EXT_BV' to `lua_Number' for argument `2' to `void lua_pushnumber(lua_State*, lua_Number)'
Looks like the change to extended bitvectors has confused it. I didn't expect them to work.
Delete the relevant line. It looks like:
ROOM_NUM_ITEM (room_flags);
These are fields I wasn't using anyway. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #2 on Mon 16 Jul 2007 06:27 AM (UTC) Amended on Mon 16 Jul 2007 06:28 AM (UTC) by Nick Gammon
|
Message
| You can get rid of the warnings easily enough. I have gone through my copy and done that, I think, although I don't compile under C++ normally.
Basically, in places where it does stuff like luaL_checknumber, you change it to luaL_checkint.
This is because a Lua "number" is really a double, and it is complaining you are converting a double to an int.
Lua actually has routines that does that for you, so by changing the function calls, the warnings go away.
eg.
- luaL_checknumber --> luaL_checkint
- lua_tonumber --> lua_tointeger
- luaL_optnumber --> luaL_optint
That gets rid of most warnings. There are a couple of others you can fix by judicious changing of data types. ;) |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #3 on Mon 16 Jul 2007 06:49 AM (UTC) |
Message
| After a bit of mucking around I got it to compile under C++ without any errors or warnings.
I put the 3 Lua includes into mud.h with appropriate lines around them so they compile in a C++ project:
#ifdef __cplusplus
extern "C" {
#endif
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
#ifdef __cplusplus
}
#endif
The new version is still 1.5 Mb and is at:
http://www.gammon.com.au/files/smaug/smaug17fuss_lua_v3.tgz
The md5sum is 4f6e146126dceb94d9580f53e731a887
I wouldn't get too excited about downloading this one, unless you are using C++. It fixes the various warnings that were raised in the post above, and has the provision for 'extern "C"' for the Lua header files. Other than that, it is the same.
|
- 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.
16,402 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top