aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormpeterv <mpeterval@gmail.com>2015-03-23 11:56:00 +0300
committermpeterv <mpeterval@gmail.com>2015-04-12 18:35:13 +0300
commitc5856f320cc5f5df78f8deb92b2a1186b9363a8e (patch)
tree92bb6ec264881894023d080340236c179f30d6be
parent4f51dbba76b5a486d6935c2b9a2ac9086b9ea64e (diff)
downloadlanes-c5856f320cc5f5df78f8deb92b2a1186b9363a8e.tar.gz
lanes-c5856f320cc5f5df78f8deb92b2a1186b9363a8e.tar.bz2
lanes-c5856f320cc5f5df78f8deb92b2a1186b9363a8e.zip
Fix standard library lists for Lua 5.3
Fixes crash on require under Lua 5.3 without LUA_COMPAT_5_2. Fixes utf8 library not loaded under Lua 5.3.
-rw-r--r--src/lanes.lua1
-rw-r--r--src/tools.c5
2 files changed, 6 insertions, 0 deletions
diff --git a/src/lanes.lua b/src/lanes.lua
index 210f325..5df406a 100644
--- a/src/lanes.lua
+++ b/src/lanes.lua
@@ -216,6 +216,7 @@ local valid_libs =
216 ["math"] = true, 216 ["math"] = true,
217 ["debug"] = true, 217 ["debug"] = true,
218 ["bit32"] = true, -- Lua 5.2 only, ignored silently under 5.1 218 ["bit32"] = true, -- Lua 5.2 only, ignored silently under 5.1
219 ["utf8"] = true, -- Lua 5.3 only, ignored silently under 5.1 and 5.2
219 -- 220 --
220 ["base"] = true, 221 ["base"] = true,
221 ["coroutine"] = true, -- part of "base" in Lua 5.1 222 ["coroutine"] = true, -- part of "base" in Lua 5.1
diff --git a/src/tools.c b/src/tools.c
index 5350e75..3a19605 100644
--- a/src/tools.c
+++ b/src/tools.c
@@ -194,8 +194,13 @@ static const luaL_Reg libs[] =
194 { LUA_OSLIBNAME, luaopen_os}, 194 { LUA_OSLIBNAME, luaopen_os},
195 { LUA_IOLIBNAME, luaopen_io}, 195 { LUA_IOLIBNAME, luaopen_io},
196#endif // PLATFORM_XBOX 196#endif // PLATFORM_XBOX
197#if LUA_VERSION_NUM >= 503
198 { LUA_UTF8LIBNAME, luaopen_utf8},
199#endif
197#if LUA_VERSION_NUM >= 502 200#if LUA_VERSION_NUM >= 502
201#ifdef luaopen_bit32
198 { LUA_BITLIBNAME, luaopen_bit32}, 202 { LUA_BITLIBNAME, luaopen_bit32},
203#endif
199 { LUA_COLIBNAME, luaopen_coroutine}, // Lua 5.2: coroutine is no longer a part of base! 204 { LUA_COLIBNAME, luaopen_coroutine}, // Lua 5.2: coroutine is no longer a part of base!
200#else // LUA_VERSION_NUM 205#else // LUA_VERSION_NUM
201 { LUA_COLIBNAME, NULL}, // Lua 5.1: part of base package 206 { LUA_COLIBNAME, NULL}, // Lua 5.1: part of base package