0 Favourites

# How do I know whether a value of an array is string or int?

• 3 posts
• so, imagine an RPG where you have healers that can restore a certain amount of HP, give a positive effect to your party members (attack up, speed up, defense up, etc.), or restore a negative effect (cures poison, paralisys, or confusion).

I'm storing the skills in an array with the X row as the name, Y row as the target (single member, or all party members), and Z row as the effect. If the Z row is an int then I'll calculate the number of HP restored using a math formula, but if the Z row is a string then I'll do something based on it (whether raising stats or restoring negative effects)

what I don't understand is how do I know whether the value I retrieve from an array is an int or a string?

so maybe if I'm checking the value like this

``````    allSkills Value at (1, 1, 1) = isInt | (add action)
[/code:3gygoytq]

in javascript we can do typeOf but I'm not sure how C2 does this
any suggestions would be appreciated, thanks.``````
• You could check if int(Array.At(1, 1, 1)) > 0 then it's a number, as long as you don't have string values like "42", that are string representations of numbers..