Changeset 2509 for code/branches/buildsystem2/src/tolua/lua/module.lua
- Timestamp:
- Dec 17, 2008, 8:59:48 PM (16 years ago)
- Location:
- code/branches/buildsystem2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/buildsystem2
- Property svn:ignore deleted
- Property svn:mergeinfo changed
/code/branches/buildsystem (added) merged: 1875,1882-1886,1975-1982,1991,1999,2054,2061,2135,2137-2139,2197-2199,2204,2214-2220,2223-2224,2229,2233-2244,2248-2249,2252-2253,2260,2275
-
code/branches/buildsystem2/src/tolua/lua/module.lua
r2087 r2509 17 17 -- {i} = list of objects in the module. 18 18 classModule = { 19 classtype = 'module'19 classtype = 'module' 20 20 } 21 21 classModule.__index = classModule … … 24 24 -- register module 25 25 function 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=131 while self[i] do32 self[i]:register(pre..' ')33 i = i+134 end35 output(pre..'tolua_endmodule(tolua_S);')36 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() 37 37 end 38 38 39 39 -- Print method 40 40 function classModule:print (ident,close) 41 print(ident.."Module{")42 print(ident.." name = '"..self.name.."';")43 local i=144 while self[i] do45 self[i]:print(ident.." ",",")46 i = i+147 end48 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) 49 49 end 50 50 51 51 -- Internal constructor 52 52 function _Module (t) 53 setmetatable(t,classModule)54 append(t)55 return t53 setmetatable(t,classModule) 54 append(t) 55 return t 56 56 end 57 57 … … 59 59 -- Expects two string representing the module name and body. 60 60 function Module (n,b) 61 local t = _Module(_Container{name=n})62 push(t)63 t:parse(strsub(b,2,strlen(b)-1)) -- eliminate braces64 pop()65 return t61 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 66 66 end 67 67
Note: See TracChangeset
for help on using the changeset viewer.