Bug - Not A Bug Possible Bug(s) with To_datatype() Functions

I have been working on the wiki recently by adding examples to various functions. I got to the to_datatype() functions and found that they behaved different from what the wiki was stating. For instance, to_boolean claimed to work on any datatype and that data_types that gave anything >= 1, would give true. However, doing to_boolean($item[mae west]) gave undefined error. So, I changed the wiki and made a note of it.

I continued on and found similar examples where the to_datatypes behaved differently from the wiki and just kept changing the wiki. However, I got to to_int and started wondering if the problem was not misinformation on the wiki but rather something wrong with KoLMafia. I was doing an example for to_int($location) but couldn't think of any location names off the top of my head. So I did, to_location(32) and it gave me $location[The Batrat and Ratbat Burrow]. Then I put print(to_int($location[The Batrat and Ratbat Burrow]); and it gave me "Function 'to_int( location )' undefined." which seems really strange....

Also, when doing to_float($item[]) I'd get undefined, but the wiki claimed it did a to_int conversion then to_float, which should work since to_int($item[]) works fine.

I guess the question is, did all these get changed over time and the wiki was never updated? Or did something go wrong somewhere?
 

Bale

Minion
The wiki is bugged, not KoLmafia. Once upon a time the to_data functions did accept a wider variety of inputs before they were more strongly typed. I can't really remember much of the discussion around that issue. Maybe it was THIS commit?

Thank you for finding the problem. Wiki does need updating where this is involved.

Incidentally, to_url($location[The Batrat and Ratbat Burrow]) does the only thing that I'd ever want from to_int(location).
 
Top