capturing numbers into variables

Post Reply
DanaLea73
Posts: 46
Joined: Fri Jul 09, 2010 12:04 am

capturing numbers into variables

Post by DanaLea73 »

here's a screenshot of my trigger.
Screen shot 2010-09-14 at 7.37.44 AM.png
Screen shot 2010-09-14 at 7.37.44 AM.png (29.24 KiB) Viewed 3617 times
how can I get that string as a number so I can add it to other numbers?

also.. the syntax for adding would be:
totalqp = questreward + othervar + 5
??

-Cera

User avatar
Heiko
Site Admin
Posts: 1548
Joined: Wed Mar 11, 2009 6:26 pm

Re: capturing numbers into variables

Post by Heiko »

matches[n] is passed into Lua as string values and must be explicitly casted into numbers by the function tonumber().
Code: [show] | [select all] lua
questreward = tonumber( matches[2] )
totalqp = questreward + othervar + 5

DanaLea73
Posts: 46
Joined: Fri Jul 09, 2010 12:04 am

Re: capturing numbers into variables

Post by DanaLea73 »

thanks!

Post Reply