* luci/libs/core: strip bytecode from serialized data too in get_bytecode()
This commit is contained in:
parent
d240fb4d8c
commit
81cf9b0206
1 changed files with 7 additions and 4 deletions
|
@ -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
|
-- @param val Value to return as bytecode
|
||||||
-- @return String value containing the bytecode of the given data
|
-- @return String value containing the bytecode of the given data
|
||||||
function get_bytecode(val)
|
function get_bytecode(val)
|
||||||
|
local code
|
||||||
|
|
||||||
if type(val) == "function" then
|
if type(val) == "function" then
|
||||||
local code = string.dump(val)
|
code = string.dump(val)
|
||||||
return code and strip_bytecode(code)
|
|
||||||
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
|
end
|
||||||
|
|
||||||
--- Strips unnescessary lua bytecode from given string. Information like line
|
--- Strips unnescessary lua bytecode from given string. Information like line
|
||||||
|
|
Loading…
Reference in a new issue