Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/tolua/lua/compat-5.1.lua @ 5397

Last change on this file since 5397 was 2710, checked in by rgrieder, 16 years ago

Merged buildsystem3 containing buildsystem2 containing Adi's buildsystem branch back to the trunk.
Please update the media directory if you were not using buildsystem3 before.

  • Property svn:eol-style set to native
File size: 969 bytes
RevLine 
[2087]1if string.find(_VERSION, "5%.0") then
[2710]2    return
[2087]3end
4
5-- "loadfile"
6local 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)
28    return f()
[2087]29end
30
31old_dofile = dofile
32dofile = pp_dofile
33
34
35-- string.gsub
36--[[
37local ogsub = string.gsub
38local function compgsub(a,b,c,d)
[2710]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)
[2087]44end
45string.repl = ogsub
46--]]
47
48--string.gsub = compgsub
49
50
51
52
Note: See TracBrowser for help on using the repository browser.