summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2009-11-17 16:12:53 +0000
committerSteven Barth <steven@midlink.org>2009-11-17 16:12:53 +0000
commit23e0a7da6a698072871081364e8c7edf76a36f32 (patch)
treef67784b6e391037d0f6f6bd4407c9e235e49b761
parent2176dae3a0a648805f7de447e4af7ead8b7655dd (diff)
CBI: Allow lazy loading of wizard pages (improving RAM usage)
-rw-r--r--libs/cbi/luasrc/cbi.lua16
1 files changed, 11 insertions, 5 deletions
diff --git a/libs/cbi/luasrc/cbi.lua b/libs/cbi/luasrc/cbi.lua
index 5a1d923853..9b947cb2f0 100644
--- a/libs/cbi/luasrc/cbi.lua
+++ b/libs/cbi/luasrc/cbi.lua
@@ -519,10 +519,6 @@ function Delegator.__init__(self, ...)
end
function Delegator.set(self, name, node)
- if type(node) == "table" and getmetatable(node) == nil then
- node = Compound(unpack(node))
- end
- assert(type(node) == "function" or instanceof(node, Compound), "Invalid")
assert(not self.nodes[name], "Duplicate entry")
self.nodes[name] = node
@@ -562,7 +558,17 @@ function Delegator.set_route(self, ...)
end
function Delegator.get(self, name)
- return self.nodes[name]
+ local node = self.nodes[name]
+
+ if type(node) == "string" then
+ node = load(node)
+ end
+
+ if type(node) == "table" and getmetatable(node) == nil then
+ node = Compound(unpack(node))
+ end
+
+ return node
end
function Delegator.parse(self, ...)