We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Script loading is quite clunky as it stands right now, given its form of a giant if else block, we would like to see it be cleaned up a bit.
Instead of the if else chain in the script loader, something like the following is wanted:
map<string, std::function<CppScripts::Script*()>> ScriptLoader = { {"scripts/test.lua", [](){ return new Test(); } }, {"scripts/foo.lua", [](){ return new Foo(); } }, // and so it goes };
When creating the initial copy of a script, the following would be done:
map<string, std::function<CppScripts::Script*()>> ScriptLoader = { {"scripts/test.lua", [](){ return new Test(); } }, {"scripts/foo.lua", [](){ return new Foo(); } }, // and so it goes }; std::map<string, CppScripts::Script*> cache; CppScripts::Script* GetScript(string script_name) { auto itr = cache.find(script_name); if (itr != cache.end()) return itr->second; auto itrLoad = ScriptLoader[script_name]; if (itrLoad == ScriptLoader.end()) { cache[script_name] = InvalidScript; return InvalidScript; } auto toReturn = itrLoad->second(); cache[script_name] = toReturn; return toReturn; }
During the migration, its possible an error could cause a script to be missing accidentally due to a typo or another issue
modifying windows build to support if else chains longer than 128 blocks
Shoutouts windows for enforcing a limit that doesnt need to exist
The text was updated successfully, but these errors were encountered:
Note: This issue is for someone else for right now.
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Is your feature request related to a problem?
Script loading is quite clunky as it stands right now, given its form of a giant if else block, we would like to see it be cleaned up a bit.
Describe the solution you'd like
Instead of the if else chain in the script loader, something like the following is wanted:
When creating the initial copy of a script, the following would be done:
Repository breaking implications
During the migration, its possible an error could cause a script to be missing accidentally due to a typo or another issue
Describe alternatives you've considered
modifying windows build to support if else chains longer than 128 blocks
Additional context
Shoutouts windows for enforcing a limit that doesnt need to exist
The text was updated successfully, but these errors were encountered: