【发布时间】:2020-12-28 20:28:12
【问题描述】:
我试图保留我遇到的 Lua 代码的各种示例以供重复使用,其中 strtohex() 和 hextostr() 就是一个示例,但我只能在下面找到 strToHex() ..
local s = "175"
local function strToHex(s)
local bytes = {}
for i=1,s:len() do
bytes[#bytes+1] = ('%2x'):format(s:byte(i,i))
end
return table.concat(bytes, ' ')
--return table.concat(bytes, '')
end
print(strToHex(s))
有没有人可以分享 hextostr() 的例子?
【问题讨论】: