Duplicate identifier 'LoadString' found ...

Monkey Forums/Monkey Programming/Duplicate identifier 'LoadString' found ...

Yoda(Posted May) [#1]
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).


MikeHart(Posted May) [#2]
Depending on the platform you target, prefix your Loadstring command with the module. For an example:

gamedata=os.LoadString("monkey://data/gamestate.txt")



Yoda(Posted May) [#3]
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?


SLotman(Posted May) [#4]
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.