Hello there,
For a current project I need to distinguish internally at Krpano the categories of attributes. I'm working currently with automatic gallery scenes creation, it's based in a single attribute to categorize it but if user sets it's value wrong, let's say it should be category="aerial" but instead a number was used it screws all the automation. I need to set some conditionals to distinguish if a non string value was assigned and to report/correct the issue.
Is there a way to find out the kind of category of an attribute for this purpose?
Thanks!
Luis
Finding out the kind of attribute (Number, boolean, string)
-
-
Hi,
the exact type doesn't need to be defined for krpano, the action or the operation where a variable will be used defines the type in the most cases...
E.g. even when a variable is a string like "123" it will be possible to use it in a mathematical calculation (similar to JS).
For checking if a variable is a number you could try this:
The multiplication forces a conversion to a number, and for non-numbers this will fail. So when the value is still the same after the multiplication, it is a number.Best regards,
Klaus -
Thanks Klaus,
I find this method useful on some cases but won't work to distinguish a string of a boolean. Anyway, thanks for you help and I'll certainly use this method when it's appliable.
Best
Luis -
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!