summaryrefslogtreecommitdiffstats
path: root/lib/tolua++/src/bin/lua/compat-5.1.lua
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2013-11-27 09:23:17 +0100
committerMattes D <github@xoft.cz>2013-11-27 09:23:17 +0100
commit49760db89d94ede5d123d927141a6cd60dbaaf07 (patch)
tree6c6cf99e4cf3128311a93cd187947b502f3732a0 /lib/tolua++/src/bin/lua/compat-5.1.lua
parentcWorld::SpawnExperienceOrb() now returns the entity ID of the spawned orb. (diff)
parentFixed VC2008 compilation, normalized include paths. (diff)
downloadcuberite-49760db89d94ede5d123d927141a6cd60dbaaf07.tar
cuberite-49760db89d94ede5d123d927141a6cd60dbaaf07.tar.gz
cuberite-49760db89d94ede5d123d927141a6cd60dbaaf07.tar.bz2
cuberite-49760db89d94ede5d123d927141a6cd60dbaaf07.tar.lz
cuberite-49760db89d94ede5d123d927141a6cd60dbaaf07.tar.xz
cuberite-49760db89d94ede5d123d927141a6cd60dbaaf07.tar.zst
cuberite-49760db89d94ede5d123d927141a6cd60dbaaf07.zip
Diffstat (limited to 'lib/tolua++/src/bin/lua/compat-5.1.lua')
-rw-r--r--lib/tolua++/src/bin/lua/compat-5.1.lua57
1 files changed, 57 insertions, 0 deletions
diff --git a/lib/tolua++/src/bin/lua/compat-5.1.lua b/lib/tolua++/src/bin/lua/compat-5.1.lua
new file mode 100644
index 000000000..7a2c60b69
--- /dev/null
+++ b/lib/tolua++/src/bin/lua/compat-5.1.lua
@@ -0,0 +1,57 @@
+if string.find(_VERSION, "5%.0") then
+ return
+end
+
+-- "loadfile"
+local function pp_dofile(path)
+
+ local loaded = false
+ local getfile = function()
+
+ if loaded then
+ return
+ else
+ local file,err = io.open(path)
+ if not file then
+ error("error loading file "..path..": "..err)
+ end
+ local ret = file:read("*a")
+ file:close()
+
+ ret = string.gsub(ret, "%.%.%.%s*%)", "...) local arg = {n=select('#', ...), ...};")
+
+ loaded = true
+ return ret
+ end
+ end
+
+ local f = load(getfile, path)
+ if not f then
+
+ error("error loading file "..path)
+ end
+ return f()
+end
+
+old_dofile = dofile
+dofile = pp_dofile
+
+
+-- string.gsub
+--[[
+local ogsub = string.gsub
+local function compgsub(a,b,c,d)
+ if type(c) == "function" then
+ local oc = c
+ c = function (...) return oc(...) or '' end
+ end
+ return ogsub(a,b,c,d)
+end
+string.repl = ogsub
+--]]
+
+--string.gsub = compgsub
+
+
+
+