LoadString() of Null
Monkey Forums/Monkey Programming/LoadString() of Null
| ||
Using this snippet, [monkeycode] Print LoadString("mazes/1.txt") ' or even Local fString:String = LoadString("mazes/1.txt") [/monkeycode] I get this error: Monkey Runtime Error : TypeError: Cannot call method 'LoadString' of null The file exists, so I have no idea why this isn't working. :-/ Clues, solutions, welcome. |
| ||
Hi, LoadString is a Mojo function, and Mojo functions can only be called once OnCreate is executed. So LoadString needs to go inside OnCreate (or later). |
| ||
I have it inside a Main() function of a module I've created. I run the module when I want to test the functionality of the module. I'm trying to load a string from a file, then pass that loaded string to a constructor, which, apparently, I can't do. Soooo... my options are: + Make a constructor that receives a filename + Wrap the testing inside a class What's best? |