Re: What's the point of map:map type if load_map() messes it up?
- Posted by mattlewis (admin) Sep 12, 2011
- 1269 views
euphoric said...
I have
map:map new_game = map:load_map( filename & ".cgm" )
but if map:load_map() returns -1 (due to file not existing), I get a type error (type_check failure, new_game is -1). So, the definition of type map is useless! Do I have to resort to this:
Depends. This error only happens when type checking is on, which is supposed to be for development, since it can slow your code down. If you think this is likely, like when you ask a user for a random file that may or may not be legit, then you'll probably be testing it anyways.
Matt