-- params@num integer-- params@radix integer 进制基数(2~) 默认为10-- NOTE:先不输出符号function NumberToArray(num, radix) if type(num) ~= "number" and tonumber(num) == nil then ERROR("NumberToArray", "params is not a number : ",num); return { 0}; end num = math.abs(tonumber(num));if num == 0 then INFO("tl.NumberToArray", "params 0 "); return { 0}; end radix = math.abs(tonumber(radix) or 10); if radix <= 1 then ERROR("tl.NumberToArray", "radix is error : ",num); return { 0}; end local retArray = {}; while num ~= 0 do table.insert(retArray, 1, math.mod(num, radix)); num = math.floor(num/radix); end return retArray;end