Re: What's the point of map:map type if load_map() messes it up?

new topic     » goto parent     » topic index » view thread      » older message » newer message
mattlewis said...
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

It's funny you mention it, because I don't think I ever turn type checking off. :) Do translated programs automatically have type checking off?

Anyway, I've added a check to make sure the file exists.

Thank you!

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu