summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/l-lua.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/mkiv/l-lua.lua')
-rw-r--r--tex/context/base/mkiv/l-lua.lua46
1 files changed, 38 insertions, 8 deletions
diff --git a/tex/context/base/mkiv/l-lua.lua b/tex/context/base/mkiv/l-lua.lua
index 88cde6d1e..426706f06 100644
--- a/tex/context/base/mkiv/l-lua.lua
+++ b/tex/context/base/mkiv/l-lua.lua
@@ -17,28 +17,37 @@ if not modules then modules = { } end modules ['l-lua'] = {
-- utf.*
-- bit32
--- compatibility hacksand helpers
+local next, type, tonumber = next, type, tonumber
-_MAJORVERSION, _MINORVERSION = string.match(_VERSION,"^[^%d]+(%d+)%.(%d+).*$")
+-- compatibility hacks and helpers
-_MAJORVERSION = tonumber(_MAJORVERSION) or 5
-_MINORVERSION = tonumber(_MINORVERSION) or 1
-_LUAVERSION = _MAJORVERSION + _MINORVERSION/10
+LUAMAJORVERSION, LUAMINORVERSION = string.match(_VERSION,"^[^%d]+(%d+)%.(%d+).*$")
-if _LUAVERSION < 5.2 and jit then
+LUAMAJORVERSION = tonumber(LUAMAJORVERSION) or 5
+LUAMINORVERSION = tonumber(LUAMINORVERSION) or 1
+LUAVERSION = LUAMAJORVERSION + LUAMINORVERSION/10
+
+if LUAVERSION < 5.2 and jit then
--
-- we want loadstring cum suis to behave like 5.2
--
- _MINORVERSION = 2
- _LUAVERSION = 5.2
+ MINORVERSION = 2
+ LUAVERSION = 5.2
end
+_LUAVERSION = LUAVERSION -- for old times sake, will go away
+
-- lpeg
if not lpeg then
lpeg = require("lpeg")
end
+-- if utf8 then
+-- utf8lua = utf8
+-- utf8 = nil
+-- end
+
-- basics:
if loadstring then
@@ -220,3 +229,24 @@ if not FFISUPPORTED then
elseif not ffi.number then
ffi.number = tonumber
end
+
+if not bit32 then -- and utf8 then
+ -- bit32 = load ( [[ -- replacement code with 5.3 syntax so that 5.2 doesn't bark on it ]] )
+ bit32 = require("l-bit32")
+end
+
+-- We need this due a bug in luatex socket loading:
+
+local loaded = package.loaded
+
+if not loaded["socket"] then loaded["socket"] = loaded["socket.core"] end
+if not loaded["mime"] then loaded["mime"] = loaded["mime.core"] end
+
+if not socket.mime then socket.mime = package.loaded["mime"] end
+
+if not loaded["socket.mime"] then loaded["socket.mime"] = socket.mime end
+if not loaded["socket.http"] then loaded["socket.http"] = socket.http end
+if not loaded["socket.ftp"] then loaded["socket.ftp"] = socket.ftp end
+if not loaded["socket.smtp"] then loaded["socket.smtp"] = socket.smtp end
+if not loaded["socket.tp"] then loaded["socket.tp"] = socket.tp end
+if not loaded["socket.url"] then loaded["socket.url"] = socket.url end