Last change
on this file since 2234 was
2229,
checked in by rgrieder, 16 years ago
|
Cleaned up indentation chaos in tolua. There were tabs and 1 space indentations, even mixed in a single block.
It should now be possible to actually pimp these files.
|
File size:
1021 bytes
|
Rev | Line | |
---|
[1650] | 1 | if string.find(_VERSION, "5%.0") then |
---|
[2229] | 2 | return |
---|
[1650] | 3 | end |
---|
| 4 | |
---|
| 5 | -- "loadfile" |
---|
| 6 | local function pp_dofile(path) |
---|
[2229] | 7 | local loaded = false |
---|
| 8 | local getfile = function() |
---|
[1650] | 9 | |
---|
[2229] | 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() |
---|
[1650] | 19 | |
---|
[2229] | 20 | ret = string.gsub(ret, "%.%.%.%s*%)", "...) local arg = {n=select('#', ...), ...};") |
---|
[1650] | 21 | |
---|
[2229] | 22 | loaded = true |
---|
| 23 | return ret |
---|
| 24 | end |
---|
| 25 | end |
---|
[1650] | 26 | |
---|
[2229] | 27 | local f = load(getfile, path) |
---|
| 28 | return f() |
---|
[1650] | 29 | end |
---|
| 30 | |
---|
| 31 | old_dofile = dofile |
---|
| 32 | dofile = pp_dofile |
---|
| 33 | |
---|
| 34 | |
---|
| 35 | -- string.gsub |
---|
| 36 | --[[ |
---|
| 37 | local ogsub = string.gsub |
---|
| 38 | local function compgsub(a,b,c,d) |
---|
[2229] | 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) |
---|
[1650] | 44 | end |
---|
| 45 | string.repl = ogsub |
---|
| 46 | --]] |
---|
| 47 | |
---|
| 48 | --string.gsub = compgsub |
---|
| 49 | |
---|
| 50 | |
---|
| 51 | |
---|
| 52 | |
---|
Note: See
TracBrowser
for help on using the repository browser.