projects
/
project
/
luci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
d240fb4
)
* luci/libs/core: strip bytecode from serialized data too in get_bytecode()
author
Jo-Philipp Wich
<jow@openwrt.org>
Sat, 26 Jul 2008 00:30:22 +0000
(
00:30
+0000)
committer
Jo-Philipp Wich
<jow@openwrt.org>
Sat, 26 Jul 2008 00:30:22 +0000
(
00:30
+0000)
libs/core/luasrc/util.lua
patch
|
blob
|
history
diff --git
a/libs/core/luasrc/util.lua
b/libs/core/luasrc/util.lua
index
2686445
..
2d821ac
100644
(file)
--- 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
--
--- 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)
-- @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
if type(val) == "function" then
- local code = string.dump(val)
- return code and strip_bytecode(code)
+ code = string.dump(val)
else
else
-
return
string.dump( loadstring( "return " .. serialize_data(val) ) )
+
code =
string.dump( loadstring( "return " .. serialize_data(val) ) )
end
end
+
+ return code and strip_bytecode(code)
end
--- Strips unnescessary lua bytecode from given string. Information like line
end
--- Strips unnescessary lua bytecode from given string. Information like line