diff options
author | faketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2011-10-03 21:25:04 +0200 |
---|---|---|
committer | faketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2011-10-03 21:25:04 +0200 |
commit | aafef187ef856a36c3f8e599afea2dee44f08904 (patch) | |
tree | c84762cc768da2800a0f80b902c704e782bd29ef /tolua++-1.0.93/src/bin/lua/compat-5.1.lua | |
parent | MCServer c++ source files (diff) | |
download | cuberite-aafef187ef856a36c3f8e599afea2dee44f08904.tar cuberite-aafef187ef856a36c3f8e599afea2dee44f08904.tar.gz cuberite-aafef187ef856a36c3f8e599afea2dee44f08904.tar.bz2 cuberite-aafef187ef856a36c3f8e599afea2dee44f08904.tar.lz cuberite-aafef187ef856a36c3f8e599afea2dee44f08904.tar.xz cuberite-aafef187ef856a36c3f8e599afea2dee44f08904.tar.zst cuberite-aafef187ef856a36c3f8e599afea2dee44f08904.zip |
Diffstat (limited to 'tolua++-1.0.93/src/bin/lua/compat-5.1.lua')
-rw-r--r-- | tolua++-1.0.93/src/bin/lua/compat-5.1.lua | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/tolua++-1.0.93/src/bin/lua/compat-5.1.lua b/tolua++-1.0.93/src/bin/lua/compat-5.1.lua new file mode 100644 index 000000000..c2642d3a6 --- /dev/null +++ b/tolua++-1.0.93/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
+
+
+
+
|