Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 19, 2008, 4:40:43 PM (15 years ago)
Author:
rgrieder
Message:

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:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/buildsystem/src/tolua/lua/compat-5.1.lua

    r1755 r2229  
    11if string.find(_VERSION, "5%.0") then
    2         return
     2    return
    33end
    44
    55-- "loadfile"
    66local function pp_dofile(path)
     7    local loaded = false
     8    local getfile = function()
    79
    8         local loaded = false
    9         local getfile = function()
     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()
    1019
    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            ret = string.gsub(ret, "%.%.%.%s*%)", "...) local arg = {n=select('#', ...), ...};")
    2021
    21                         ret = string.gsub(ret, "%.%.%.%s*%)", "...) local arg = {n=select('#', ...), ...};")
     22            loaded = true
     23            return ret
     24        end
     25    end
    2226
    23                         loaded = true
    24                         return ret
    25                 end
    26         end
    27 
    28         local f = load(getfile, path)
    29         return f()
     27    local f = load(getfile, path)
     28    return f()
    3029end
    3130
     
    3837local ogsub = string.gsub
    3938local 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)
     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)
    4544end
    4645string.repl = ogsub
Note: See TracChangeset for help on using the changeset viewer.