Differences between "standard" Lua and the one in MUSHclient

Posted by Nick Gammon on Fri 13 Apr 2007 01:55 AM — 2 posts, 10,030 views.

Australia Forum Administrator #0
For the record, this is a "diff" of the Lua DLL supplied with MUSHclient, compared to the standard distribution from www.lua.org:


diff lua-5.1.1/src/Makefile lua-5.1.1.nick/src/Makefile
11c11
< CFLAGS= -O2 -Wall $(MYCFLAGS)
---
> CFLAGS= -O3 -Wall $(MYCFLAGS)
103c103
< 	$(MAKE) "LUA_A=lua51.dll" "LUA_T=lua.exe" \
---
> 	$(MAKE) "LUA_A=lua5.1.dll" "LUA_T=lua.exe" \
diff lua-5.1.1/src/luaconf.h lua-5.1.1.nick/src/luaconf.h
336c336
< #define LUA_COMPAT_VARARG
---
> #undef LUA_COMPAT_VARARG
343c343
< #define LUA_COMPAT_MOD
---
> #undef LUA_COMPAT_MOD
351c351
< #define LUA_COMPAT_LSTR		1
---
> #undef LUA_COMPAT_LSTR
358c358
< #define LUA_COMPAT_GFIND
---
> #undef LUA_COMPAT_GFIND
366a367
> //#undef LUA_COMPAT_OPENLIB
737a739,740
> #define  LUA_USELONGLONG // njg
> 
740c743
< #define LUA_INTFRMLEN		"ll"
---
> #define LUA_INTFRMLEN		"I64"
742a746,748
> //#define LUA_INTFRMLEN		"I64"     // njg
> //#define LUA_INTFRM_T		__int64     // njg
> 


Basically the changes are:

  • Cranked optimization up from O2 (Optimize even more) to O3 (Optimize yet more).
  • Changed the DLL name to lua5.1.dll (rather than lua51.dll).
  • Turn off some compatability options: LUA_COMPAT_VARARG, LUA_COMPAT_MOD, LUA_COMPAT_LSTR, LUA_COMPAT_GFIND and LUA_COMPAT_OPENLIB. The comments in the file luaconf.h suggest turning those off as soon as possible, so I have done that.
  • Turn on the option LUA_USELONGLONG, and use the appropriate format specifiers, in order to better support conversion from floating point to integers.


It is also worth pointing out that to make the DLL (under Cygwin) I had to use this command line:


make "CC=gcc -mno-cygwin" mingw


If you don't specify "-mno-cygwin" then it builds a dependency on cygwin.dll, which adds an extra DLL to ship, and extra space.
Amended on Fri 13 Apr 2007 02:02 AM by Nick Gammon
Australia Forum Administrator #1
If you choose to compile it under MS Visual Studio 6, you have to change the "long long" type to __int64, which is why that is there, commented out.