04-03-2014, 10:27 PM
Tried my hand at making a gil/hr add on just to get better at lua coding but I'll leave it here til yours gets fixed. :)
Might want to have a look at my string format function, I think its pretty handy to spit out formatted numbers (1234->1,234) for whenever you get this project going.
edit: I dont intend on ever updating this or maintaining it, was just for shits and gigs
<removed>
Might want to have a look at my string format function, I think its pretty handy to spit out formatted numbers (1234->1,234) for whenever you get this project going.
PHP Code:
function formatStr(myStr)
local a1,a2,a3
local b1,b2,b3
local c1
local neg=0
if (tonumber(myStr)<0) then
neg=1
myStr=string.sub(myStr,2)
end
if (string.len(myStr)==4) then
a1=string.sub (myStr, 1,1)
b1=string.sub (myStr, 2)
myStr= a1..","..b1
elseif (string.len(myStr)==5) then
a1=string.sub (myStr, 1,2)
b1=string.sub (myStr, 3)
myStr=a1..","..b1
elseif (string.len(myStr)==6) then
a1=string.sub (myStr, 1,3)
b1=string.sub (myStr, 4)
myStr=a1..","..b1
elseif (string.len(myStr)==7) then
a1=string.sub (myStr, 1,1)
b1=string.sub (myStr, 2,4)
c1=string.sub (myStr, 5)
myStr=a1..","..b1..","..c1
elseif (string.len(myStr)==8) then
a1=string.sub (myStr, 1,2)
b1=string.sub (myStr, 3,5)
c1=string.sub (myStr, 6)
myStr=a1..","..b1..","..c1
end
if (neg==1) then
myStr="-"..myStr
end
return myStr
end
edit: I dont intend on ever updating this or maintaining it, was just for shits and gigs
<removed>