summaryrefslogtreecommitdiffhomepage
path: root/libs/core
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2008-07-26 00:30:22 +0000
committerJo-Philipp Wich <jow@openwrt.org>2008-07-26 00:30:22 +0000
commit81cf9b02065714ad6976dc6466a3b84ffa0f06c7 (patch)
treef13e7c310e1617cc7efcd43154e213e5a65d8602 /libs/core
parentd240fb4d8c7d027c7a9d5b47662ea7ccc9394801 (diff)
* luci/libs/core: strip bytecode from serialized data too in get_bytecode()
Diffstat (limited to 'libs/core')
-rw-r--r--libs/core/luasrc/util.lua11
1 files changed, 7 insertions, 4 deletions
diff --git a/libs/core/luasrc/util.lua b/libs/core/luasrc/util.lua
index 2686445de..2d821acff 100644
--- a/libs/core/luasrc/util.lua
+++ b/libs/core/luasrc/util.lua
@@ -441,16 +441,19 @@ end
--
--- Return the current runtime bytecode of the given data. The byte code
--- will be stripped before it is returned if the given value is a function.
+-- will be stripped before it is returned.
-- @param val Value to return as bytecode
-- @return String value containing the bytecode of the given data
function get_bytecode(val)
+ local code
+
if type(val) == "function" then
- local code = string.dump(val)
- return code and strip_bytecode(code)
+ code = string.dump(val)
else
- return string.dump( loadstring( "return " .. serialize_data(val) ) )
+ code = string.dump( loadstring( "return " .. serialize_data(val) ) )
end
+
+ return code and strip_bytecode(code)
end
--- Strips unnescessary lua bytecode from given string. Information like line