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