Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 17, 2008, 8:59:48 PM (16 years ago)
Author:
rgrieder
Message:

Merged revisions 1875-2278 of the buildsystem branch to buildsystem2.

Location:
code/branches/buildsystem2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/buildsystem2

  • code/branches/buildsystem2/src/tolua/lua/module.lua

    r2087 r2509  
    1717--    {i} = list of objects in the module.
    1818classModule = {
    19  classtype = 'module'
     19    classtype = 'module'
    2020}
    2121classModule.__index = classModule
     
    2424-- register module
    2525function classModule:register (pre)
    26  pre = pre or ''
    27  push(self)
    28  output(pre..'tolua_module(tolua_S,"'..self.name..'",',self:hasvar(),');')
    29  output(pre..'tolua_beginmodule(tolua_S,"'..self.name..'");')
    30  local i=1
    31  while self[i] do
    32   self[i]:register(pre..' ')
    33   i = i+1
    34  end
    35  output(pre..'tolua_endmodule(tolua_S);')
    36         pop()
     26    pre = pre or ''
     27    push(self)
     28    output(pre..'tolua_module(tolua_S,"'..self.name..'",',self:hasvar(),');')
     29    output(pre..'tolua_beginmodule(tolua_S,"'..self.name..'");')
     30    local i=1
     31    while self[i] do
     32        self[i]:register(pre..' ')
     33        i = i+1
     34    end
     35    output(pre..'tolua_endmodule(tolua_S);')
     36    pop()
    3737end
    3838
    3939-- Print method
    4040function classModule:print (ident,close)
    41  print(ident.."Module{")
    42  print(ident.." name = '"..self.name.."';")
    43  local i=1
    44  while self[i] do
    45   self[i]:print(ident.." ",",")
    46   i = i+1
    47  end
    48  print(ident.."}"..close)
     41    print(ident.."Module{")
     42    print(ident.." name = '"..self.name.."';")
     43    local i=1
     44    while self[i] do
     45        self[i]:print(ident.." ",",")
     46        i = i+1
     47    end
     48    print(ident.."}"..close)
    4949end
    5050
    5151-- Internal constructor
    5252function _Module (t)
    53  setmetatable(t,classModule)
    54  append(t)
    55  return t
     53    setmetatable(t,classModule)
     54    append(t)
     55    return t
    5656end
    5757
     
    5959-- Expects two string representing the module name and body.
    6060function Module (n,b)
    61  local t = _Module(_Container{name=n})
    62  push(t)
    63  t:parse(strsub(b,2,strlen(b)-1)) -- eliminate braces
    64  pop()
    65  return t
     61    local t = _Module(_Container{name=n})
     62    push(t)
     63    t:parse(strsub(b,2,strlen(b)-1)) -- eliminate braces
     64    pop()
     65    return t
    6666end
    6767
Note: See TracChangeset for help on using the changeset viewer.