From 998fb17fdc150bc9c6b3d8da0dd37dfd1ae7b39a Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Sun, 24 Nov 2013 14:29:35 +0000 Subject: Moved tolua++ --- lib/tolua++/src/bin/lua/compat-5.1.lua | 57 ++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 lib/tolua++/src/bin/lua/compat-5.1.lua (limited to 'lib/tolua++/src/bin/lua/compat-5.1.lua') 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 + + + + -- cgit v1.2.3