1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-24 00:19:01 +00:00

Updated stdnse.tohex() to coerce strings to numbers if possible for the first

argument. That is, the first argument is interpretted as a number if possible.
This commit is contained in:
batrick
2008-10-07 02:24:31 +00:00
parent f71135f796
commit 2c6554a435

View File

@@ -163,7 +163,7 @@ function tohex( s, options )
local separator = options.separator
local hex
if type( s ) == 'number' then
if tonumber( s ) then
hex = ("%x"):format(s)
elseif type( s ) == 'string' then
hex = ("%02x"):rep(#s):format(s:byte(1,#s))