Last change
on this file since 3129 was
3127,
checked in by rgrieder, 15 years ago
|
Update to tolua 1.0.93
|
-
Property svn:eol-style set to
native
|
File size:
1.0 KB
|
Rev | Line | |
---|
[2087] | 1 | if string.find(_VERSION, "5%.0") then |
---|
[2710] | 2 | return |
---|
[2087] | 3 | end |
---|
| 4 | |
---|
| 5 | -- "loadfile" |
---|
| 6 | local function pp_dofile(path) |
---|
[2710] | 7 | local loaded = false |
---|
| 8 | local getfile = function() |
---|
[2087] | 9 | |
---|
[2710] | 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() |
---|
[2087] | 19 | |
---|
[2710] | 20 | ret = string.gsub(ret, "%.%.%.%s*%)", "...) local arg = {n=select('#', ...), ...};") |
---|
[2087] | 21 | |
---|
[2710] | 22 | loaded = true |
---|
| 23 | return ret |
---|
| 24 | end |
---|
| 25 | end |
---|
[2087] | 26 | |
---|
[2710] | 27 | local f = load(getfile, path) |
---|
[3127] | 28 | if not f then |
---|
| 29 | error("error loading file "..path) |
---|
| 30 | end |
---|
[2710] | 31 | return f() |
---|
[2087] | 32 | end |
---|
| 33 | |
---|
| 34 | old_dofile = dofile |
---|
| 35 | dofile = pp_dofile |
---|
| 36 | |
---|
| 37 | |
---|
| 38 | -- string.gsub |
---|
| 39 | --[[ |
---|
| 40 | local ogsub = string.gsub |
---|
| 41 | local function compgsub(a,b,c,d) |
---|
[2710] | 42 | if type(c) == "function" then |
---|
| 43 | local oc = c |
---|
| 44 | c = function (...) return oc(...) or '' end |
---|
| 45 | end |
---|
| 46 | return ogsub(a,b,c,d) |
---|
[2087] | 47 | end |
---|
| 48 | string.repl = ogsub |
---|
| 49 | --]] |
---|
| 50 | |
---|
| 51 | --string.gsub = compgsub |
---|
| 52 | |
---|
| 53 | |
---|
| 54 | |
---|
| 55 | |
---|
Note: See
TracBrowser
for help on using the repository browser.