function LanguageManager:getString(key)
– some other functions …
return LanguageManager
Okay, I am using it like this require(“Language”):getString(“language.key”). The getString(key) method is looking if the LanguageManager is initialized (e.g locale is set). If it is not set, the initialized-method is called, a textfile is loaded and the keys are saved in LanguageManager.loadedText.
It works totally nice when staying in the same scene. I loaded anoter scene and replaced the Scene via cc:Director(). When using the Languagemodule again, initialize is called! But why? I thought the require Lua mechanism is only loaded once and require will always get the same module.
I also tried it with pushScene instead of replaceScene because I thought when the scene is replaced, memory is also given free. But that’s not the case. Same behaviour with pushScene
wtf … I tried a new small project and there it works … Now I need to find out why it isn’t working in my big project -.- Maybe I can contact you later if I find something… edit
meh… the error was so simple…
In one file I did: