Show
Ignore:
Timestamp:
11/17/09 17:12:53 (4 years ago)
Author:
Cyrus
Message:

CBI: Allow lazy loading of wizard pages (improving RAM usage)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • luci/trunk/libs/cbi/luasrc/cbi.lua

    r5527 r5556  
    520520 
    521521function Delegator.set(self, name, node) 
    522     if type(node) == "table" and getmetatable(node) == nil then 
    523         node = Compound(unpack(node)) 
    524     end 
    525     assert(type(node) == "function" or instanceof(node, Compound), "Invalid") 
    526522    assert(not self.nodes[name], "Duplicate entry") 
    527523 
     
    563559 
    564560function Delegator.get(self, name) 
    565     return self.nodes[name] 
     561    local node = self.nodes[name] 
     562 
     563    if type(node) == "string" then 
     564        node = load(node) 
     565    end 
     566 
     567    if type(node) == "table" and getmetatable(node) == nil then 
     568        node = Compound(unpack(node)) 
     569    end 
     570 
     571    return node 
    566572end 
    567573