Hi folks!
i just thought i would share this function with the ppl that do your own scripts
you deserve this, anyway.
(this is just like php number_format)
lib/050-function.lua
How to use?
Simple!
$value = 1234567
doCreatureSay(cid, comma_value($value) )
this will result in:
1,234,567
simple and effective, perfect for everyones banking system!
hard to read your bank value with 12 digits
i just thought i would share this function with the ppl that do your own scripts
you deserve this, anyway.
(this is just like php number_format)
lib/050-function.lua
Code:
function comma_value(amount)
local formatted = amount
while true do
formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2')
if (k==0) then
break
end
end
return formatted
end
How to use?
Simple!
$value = 1234567
doCreatureSay(cid, comma_value($value) )
this will result in:
1,234,567
simple and effective, perfect for everyones banking system!
hard to read your bank value with 12 digits