lua 通用函数

来源:互联网 发布:德儿塔青少儿编程 编辑:程序博客网 时间:2024/06/14 16:14


function tomoney(num)
nums = tostring(num)
local out = ""
local j = 1
for i = string.len(nums)  , 1 ,-1   do
local sc = string.byte(nums , i)
out = out..string.char(sc)
if (j%3 == 0 and i ~=1) then
out = out..","
end
j = j +1
end
out = string.reverse(out)
return out
end
原创粉丝点击