Changeset 2509 for code/branches/buildsystem2/src/tolua/lua/compat-5.1.lua
- Timestamp:
- Dec 17, 2008, 8:59:48 PM (16 years ago)
- Location:
- code/branches/buildsystem2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/buildsystem2
- Property svn:ignore deleted
- Property svn:mergeinfo changed
/code/branches/buildsystem (added) merged: 1875,1882-1886,1975-1982,1991,1999,2054,2061,2135,2137-2139,2197-2199,2204,2214-2220,2223-2224,2229,2233-2244,2248-2249,2252-2253,2260,2275
-
code/branches/buildsystem2/src/tolua/lua/compat-5.1.lua
r2087 r2509 1 1 if string.find(_VERSION, "5%.0") then 2 2 return 3 3 end 4 4 5 5 -- "loadfile" 6 6 local function pp_dofile(path) 7 local loaded = false 8 local getfile = function() 7 9 8 local loaded = false 9 local getfile = function() 10 if loaded then 11 return 12 else 13 local file,err = io.open(path) 14 if not file then 15 error("error loading file "..path..": "..err) 16 end 17 local ret = file:read("*a") 18 file:close() 10 19 11 if loaded then 12 return 13 else 14 local file,err = io.open(path) 15 if not file then 16 error("error loading file "..path..": "..err) 17 end 18 local ret = file:read("*a") 19 file:close() 20 ret = string.gsub(ret, "%.%.%.%s*%)", "...) local arg = {n=select('#', ...), ...};") 20 21 21 ret = string.gsub(ret, "%.%.%.%s*%)", "...) local arg = {n=select('#', ...), ...};") 22 loaded = true 23 return ret 24 end 25 end 22 26 23 loaded = true 24 return ret 25 end 26 end 27 28 local f = load(getfile, path) 29 return f() 27 local f = load(getfile, path) 28 return f() 30 29 end 31 30 … … 38 37 local ogsub = string.gsub 39 38 local function compgsub(a,b,c,d) 40 if type(c) == "function" then41 local oc = c42 c = function (...) return oc(...) or '' end43 end44 return ogsub(a,b,c,d)39 if type(c) == "function" then 40 local oc = c 41 c = function (...) return oc(...) or '' end 42 end 43 return ogsub(a,b,c,d) 45 44 end 46 45 string.repl = ogsub
Note: See TracChangeset
for help on using the changeset viewer.