Difference between revisions of "Bit.tohex"
From GiderosMobile
(Created page with "__NOTOC__ '''Available since:''' Gideros 2013.09<br/> === Description === Converts its first argument to a hex string. The number of hex digits is given by the absolute value...") |
|||
Line 4: | Line 4: | ||
Converts its first argument to a hex string. The number of hex digits is given by the absolute value of the optional second argument. Positive numbers between 1 and 8 generate lowercase hex digits. Negative numbers generate uppercase hex digits. Only the least-significant 4*|n| bits are used. The default is to generate 8 lowercase hex digits. | Converts its first argument to a hex string. The number of hex digits is given by the absolute value of the optional second argument. Positive numbers between 1 and 8 generate lowercase hex digits. Negative numbers generate uppercase hex digits. Only the least-significant 4*|n| bits are used. The default is to generate 8 lowercase hex digits. | ||
<source lang="lua"> | <source lang="lua"> | ||
− | (string) | + | (string) = bit.tohex(x,n) |
</source> | </source> | ||
'''x:''' (number) number to convert to hex string ''''''<br/> | '''x:''' (number) number to convert to hex string ''''''<br/> | ||
'''n:''' (number) number of hex digits to convert '''optional'''<br/> | '''n:''' (number) number of hex digits to convert '''optional'''<br/> | ||
'''Returns''' (string) hex string<br/> | '''Returns''' (string) hex string<br/> |
Revision as of 10:11, 23 August 2018
Available since: Gideros 2013.09
Description
Converts its first argument to a hex string. The number of hex digits is given by the absolute value of the optional second argument. Positive numbers between 1 and 8 generate lowercase hex digits. Negative numbers generate uppercase hex digits. Only the least-significant 4*|n| bits are used. The default is to generate 8 lowercase hex digits.
(string) = bit.tohex(x,n)
'x: (number) number to convert to hex string '
n: (number) number of hex digits to convert optional
Returns (string) hex string