LoadString, os and Html5
Community Forums/Monkey Talk/LoadString, os and Html5
| ||
Hi recently I download the MonkeyDemo45c and try to test some features. I guess that the os module its not compatible with HTML5 or True? I try to use os.LoadString() and get this error "Identifier LoadString not found", and the used code is: Local aa:String = os.LoadString("lang.as") Before I import the os module using: Import os I saw the LoadString function only support .txt .xml and .json extensions, I have a ResourceManager class that use .ini files to read resource definitions. (Also I implement class to read and interact with Ini files, but I don't have a way to put it on monkey official site, cause I can't have a full version of monkey. Any idea about this?) So Mark its hard to include .ini files extension to embed datas on main.js file? I guess that having a function to embed files inside main.js file with any extension is really usefully, this way the developers can embed any type of file and load it latter with LoadString... |
| ||
os module its not compatible with HTML5 |
| ||
If you check the docs > Modules reference > os: IMPORTANT! The os module is currently only available for the glfw and stdcpp targets. Re:LoadString yeah its pretty annoying with the limited formats... you can just rename the ini file to a txt file and it will still work though... |
| ||
A problem I found with LoadString is that it doesn't behave consistently across all targets. In iOS, if the loaded string contains a Chr(0) (which game data files often do), then the string will not load. The same code works perfectly in HTML5. It might go tits-up in other targets too - haven't tried, but its this kind of oddity that's taken up far more of my time than I would have liked. |
| ||
In the full version I am positive that LoadString works on HTML5. I just used it to load map data in a project. But I am importing mojo and not oS seperately and I just call LoadStirng and not os.LoadString. |
| ||
Just rechecked it. There is an os version of LoadString and a mojo version. Use that one. |