summaryrefslogtreecommitdiffhomepage
path: root/libs/core/luasrc
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-06-01 14:54:58 +0000
committerSteven Barth <steven@midlink.org>2008-06-01 14:54:58 +0000
commit6250394740a3f33e86937f1978aee1b111189208 (patch)
tree17c7caf4ded36b345eaea3bf50e1d5ced3c8895b /libs/core/luasrc
parent33c3e686958bfc969a0732385fb2823380fb55a4 (diff)
* libs/core: Adapted luci.util.strip_bytecode to handle lnum-bytecode correctly
Diffstat (limited to 'libs/core/luasrc')
-rw-r--r--libs/core/luasrc/util.lua7
1 files changed, 5 insertions, 2 deletions
diff --git a/libs/core/luasrc/util.lua b/libs/core/luasrc/util.lua
index d79f93b1d4..cc8e7a70bc 100644
--- a/libs/core/luasrc/util.lua
+++ b/libs/core/luasrc/util.lua
@@ -189,9 +189,10 @@ function split(str, pat, max, regex)
end
--- Bytecode stripping function by Peter Cawley from http://lua-users.org/lists/lua-l/2008-02/msg01158.html
+-- Strips lua bytecode
+-- Original version by Peter Cawley (http://lua-users.org/lists/lua-l/2008-02/msg01158.html)
function strip_bytecode(dump)
- local version, format, endian, int, size, ins, num = dump:byte(5, 11)
+ local version, format, endian, int, size, ins, num, lnum = dump:byte(5, 12)
local subint
if endian == 1 then
subint = function(dump, i, l)
@@ -227,6 +228,8 @@ function strip_bytecode(dump)
offset = offset + size + subint(dump, offset, size)
elseif t == 3 then
offset = offset + num
+ elseif t == 254 then
+ offset = offset + lnum
end
end
count, offset = subint(dump, offset, int)