find.gsub creates Hard restart
Posted: Fri Mar 27, 2015 1:12 am
Hi,
runing the following code on ESP8266-01 using
NodeMCU 0.9.5 build 20150318 powered by Lua 5.1.4
a hard restart is the result:
function unescape (s)
s = string.gsub(s,"%%(%x%x)",function(h) return string.char(tonumber(h,16)) end)
return s
end
str = "abc%26def"
res = unescape(str)
print (res)
The hard restart happens a second after printing the result of abc&def.
There is no difference defining the variables "str" and/or "res" as local.
Something wrong with the routine?
Regards
KurtB
runing the following code on ESP8266-01 using
NodeMCU 0.9.5 build 20150318 powered by Lua 5.1.4
a hard restart is the result:
function unescape (s)
s = string.gsub(s,"%%(%x%x)",function(h) return string.char(tonumber(h,16)) end)
return s
end
str = "abc%26def"
res = unescape(str)
print (res)
The hard restart happens a second after printing the result of abc&def.
There is no difference defining the variables "str" and/or "res" as local.
Something wrong with the routine?
Regards
KurtB