local num = 5 --数值
local j = 2 --进制
local tenSix = {
[10]="A",
[11]="B",
[12]= "C",
[13]= "D",
[14]= "E",
[15]= "F",
[16]= "10",
}
function func(num,t,str)
print("str " ..tostring(str))
local a = math.floor(num/j)
local b = math.floor(num%j)
if a > 1 then
func(a,t,str)
end
print("aaa "..a)
print("bbb "..b)
if a == 1 then
str= str ..tostring(a)
table.insert(t,a)
end
if b < j then
if j == 16 then
if tenSix[b] then
b = tenSix[b]
end
end
table.insert(t,b)
str= str ..tostring(b)
end
return str
end
local str = ""
local t ={}
local str = func(num,t,str)
print("str end "..tostring(str))
print("str "..str) -- 这个就 1 str 连接不了
print("#list ::"..#t) -- 有数据
for i,v in ipairs(t) do
print("v "..v)
end