|
Norbert Kiesel wrote:
[snip] function tohex(decimal) if type(decimal) == 'number' or #decimal < 15 then return ('%x'):format(decimal) end local hex = '' while decimal do local div = '' local mod = 0 for i = 1, #decimal do mod = mod * 10 + tonumber(decimal:sub(i, i)) local f = math.floor(mod / 16) mod = mod - f * 16div = div .. f endhex = ('%x'):format(mod) .. hex decimal = div:match('0+(.+)') end return hex end
Oh sorry, ha ha, I failed to see the nested loop. ;-) It looks real slow... :-) -- Cheers, Kein-Hong Man (esq.) Kuala Lumpur, Malaysia