From f7d9cc1a905673512a8ad5b0fd8a3261a3650b32 Mon Sep 17 00:00:00 2001 From: Yves Rizoud Date: Sat, 22 Sep 2012 17:51:37 +0000 Subject: [PATCH] Fixes support of Lua 5.0 and 5.1, and a compilation warning on Linux git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@2005 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- src/factory.c | 11 ++++++++++- src/factory.h | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/factory.c b/src/factory.c index 083a80aa..5451178c 100644 --- a/src/factory.c +++ b/src/factory.c @@ -145,7 +145,16 @@ do { \ const char * Lua_version(void) { - return LUA_VERSION_MAJOR "." LUA_VERSION_MINOR; + // LUA_RELEASE is only available since 5.2+, with format "Lua x.y.z" + // The only version information available since Lua 5.0 is LUA_VERSION, + // with the format "Lua x.y" + #if defined(LUA_RELEASE) + return LUA_RELEASE; + #elif defined (LUA_VERSION) + return LUA_VERSION; + #else + return "Unknown"; + #endif } // Updates the screen colors after a running screen has modified the palette. diff --git a/src/factory.h b/src/factory.h index ee72f878..6609771d 100644 --- a/src/factory.h +++ b/src/factory.h @@ -15,4 +15,4 @@ void Run_numbered_script(byte index); /// /// Returns a string stating the included Lua engine version, /// or "Disabled" if Grafx2 is compiled without Lua. -const char * Lua_version(void); \ No newline at end of file +const char * Lua_version(void);