/ Published in: Lua
Expand |
Embed | Plain Text
--- Returns HEX representation of num function num2hex(num) local hexstr = '0123456789abcdef' local s = '' while num > 0 do local mod = math.fmod(num, 16) s = string.sub(hexstr, mod+1, mod+1) .. s num = math.floor(num / 16) end if s == '' then s = '0' end return s end
You need to login to post a comment.
