afkmud and Lua

Posted by Orik on Sat 01 Mar 2008 07:35 PM — 10 posts, 39,490 views.

USA #0
Anyone successfully put Lua into afkmud? I've been trying and have been very unsuccessful.

Are there plans for it? Anyone ambitious to do it? lol
Australia Forum Administrator #1
My post about adding Lua to SMAUG went into some detail:

http://www.gammon.com.au/forum/?id=8000


Using that as a guide, it should be fairly easy to do, if you are reasonably familiar with Lua, and know what you are about with the MUD code.

If you say you have "been very unsuccessful" can you give more details? Error messages? Crashes? Can't work out where a particular line goes?
USA #2
Here's mud.h

/*

Lua includes :)

NJG

*/

  #include <lua.h>
  #include <lualib.h>
  #include <lauxlib.h>


Here's the make errors:


Building AFKMud....
make -s afkmud
  Compiling o/imc.o....
In file included from imc.cpp:62:
mud.h:58:19: lua.h: No such file or directory
mud.h:59:22: lualib.h: No such file or directory
mud.h:60:23: lauxlib.h: No such file or directory
In file included from mud.h:810,
                 from imc.cpp:62:
character.h:585: error: `CHAR_DATA' was not declared in this scope
character.h:585: error: `ch' was not declared in this scope
character.h:585: error: variable or field `open_lua' declared void
character.h:586: error: `CHAR_DATA' was not declared in this scope
character.h:586: error: `ch' was not declared in this scope
character.h:586: error: variable or field `close_lua' declared void
character.h:589: error: `CHAR_DATA' was not declared in this scope
character.h:589: error: `ch' was not declared in this scope
character.h:589: error: syntax error before `char'
character.h:592: error: `CHAR_DATA' was not declared in this scope
character.h:592: error: `ch' was not declared in this scope
character.h:592: error: syntax error before `char'
character.h:594: error: `CHAR_DATA' was not declared in this scope
character.h:594: error: `ch' was not declared in this scope
character.h:595: error: syntax error before `char'
character.h:599: error: `CHAR_DATA' was not declared in this scope
character.h:599: error: `ch' was not declared in this scope
character.h:600: error: syntax error before `char'
make[1]: *** [o/imc.o] Error 1
make: *** [all] Error 2


I know character.h probably needs to be changed from CHAR_DATA to char_data... I figure anyway, not sure. AFKmud is so different from what i'm used to with smaugfuss, I'm just not really sure on it.
USA #3
I fixed the above errors, but then I get a ton of errors from the lua files about syntax errors before void and int and *


Australia Forum Administrator #4
Well it won't compile without the Lua files like lua.h.

A copy is available here:

http://www.gammon.com.au/files/mushclient/lua5.1_extras/lua5.1_lib.zip

However basically you should download Lua from www.lua.org, unzip, compile and install that (make install).

I can't see how you will get far until that is done.

Quote:

... I get a ton of errors from the lua files about syntax errors ...


Even posting 10 of them helps to get a feel for the problem. It really is impossible to help when you say "I got errors" with no indication about what those errors are.
USA #5

Building AFKMud....
make -s afkmud
  Compiling o/imc.o....
In file included from mud.h:58,
                 from imc.cpp:62:
lua.h:16:21: luaconf.h: No such file or directory
In file included from mud.h:58,
                 from imc.cpp:62:
lua.h:99: error: syntax error before `;' token
lua.h:103: error: syntax error before `;' token
lua.h:110: error: syntax error before `*' token
lua.h:111: error: syntax error before `void'
lua.h:112: error: syntax error before `*' token
lua.h:114: error: syntax error before `(' token
lua.h:120: error: syntax error before `int'
lua.h:121: error: syntax error before `void'
lua.h:122: error: syntax error before `void'
lua.h:123: error: syntax error before `void'
lua.h:124: error: syntax error before `void'
lua.h:125: error: syntax error before `void'
lua.h:126: error: syntax error before `int'
lua.h:128: error: syntax error before `void'
lua.h:135: error: syntax error before `int'
lua.h:136: error: syntax error before `int'


Just just a couple errors.

Here's lua.h 99

/* type of numbers in Lua */
typedef LUA_NUMBER lua_Number;
Australia Forum Administrator #6
Quote:

lua.h:16:21: luaconf.h: No such file or directory


You can't expect it to compile cleanly with missing .h files.

A copy of that should be in the Lua distribution, and is also in the download I mentioned earlier:

http://www.gammon.com.au/files/mushclient/lua5.1_extras/lua5.1_lib.zip
USA #7
Had to change #include <luaconf.h> to "luaconf.h"

had to do that in a few other places as well.
USA #8
how do i save my makefile to a txt file?


I know it was something like this:

make > make.txt
Australia Forum Administrator #9

make &> make.txt