Duplicate identifier 'LoadString' found ...
Monkey Forums/Monkey Programming/Duplicate identifier 'LoadString' found ...
| ||
I get this error: Duplicate identifier 'LoadString' found in module 'os' and module 'app'. at this code-line: gamedata=LoadString("monkey://data/gamestate.txt") Why that? Any ideas? (And no, I don't want to use LoadState and SaveState, because I need to load and save several different strings). |
| ||
Depending on the platform you target, prefix your Loadstring command with the module. For an example:gamedata=os.LoadString("monkey://data/gamestate.txt") |
| ||
Now the error disappeared, but gamedata doesn't contain anything, although gamestate.txt is in the data-folder and contains some text. I'm on desktop (mac). Do I have to modify this in any way? |
| ||
Unless you're coding something for HTML5, forget loadstring, try using FileStream, which is way better ^_^ Anyway, to get loadstring to work, I generally use mojo.LoadString instead of os.LoadString - but do not try to load things on OnCreate, or it may not work depending on the target. |