reepblue Posted April 20 Share Posted April 20 This is for a Leadwerks project and over the few months I've fell in love with tableplusplus and I've used it for my input system in Ultra Engine. I'm trying to port it to Leadwerks but it seems my implementation of the loading and saving isn't correct. My JSON parsers work fine but no data loads, and tables don't save as pretty as when using the json library alone. Anything I'm doing wrong? #ifdef __TABLE_PLUS_PLUS table Table::Load(const std::string& path) { auto j3 = JSON::Load(path); table t(j3); return t; } table Table::Load(Stream* stream) { auto j3 = JSON::Load(stream); table t(j3); return t; } bool Table::Save(table& t, const std::string& path) { nlohmann::json j3 = t.to_json(); return JSON::Save(j3, path); } table Table::Load(const std::wstring& path) { auto j3 = JSON::Load(path); table t(j3); return t; } table Table::Load(shared_ptr<FileStream> stream) { auto j3 = JSON::Load(stream); table t(j3); return t; } bool Table::Save(table& t, const std::wstring& path) { nlohmann::json j3 = t.to_json(); return JSON::Save(j3, path); } #endif Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
reepblue Posted April 21 Author Share Posted April 21 Nevermind, loading is fine, saving is the remaining issue. For the record, this is how I'm saving my json files. bool JSON::Save(nlohmann::json& j3, const std::string& path) { std::ofstream o(path); o << std::setw(4) << j3 << std::endl; return (bool)FileSystem::GetFileType(path); } Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.