Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/questsystem/src/tolua/lua/compat-5.1.lua @ 2234

Last change on this file since 2234 was 1755, checked in by rgrieder, 16 years ago

merged gui back to trunk.
update the media repository!

File size: 880 bytes
Line 
1if string.find(_VERSION, "5%.0") then
2        return
3end
4
5-- "loadfile"
6local 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()
30end
31
32old_dofile = dofile
33dofile = pp_dofile
34
35
36-- string.gsub
37--[[
38local ogsub = string.gsub
39local 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)
45end
46string.repl = ogsub
47--]]
48
49--string.gsub = compgsub
50
51
52
53
Note: See TracBrowser for help on using the repository browser.