You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

config.cpp 588B

123456789101112131415161718
  1. #include "config.h"
  2. #include "sol.hpp"
  3. template <>
  4. std::string Config::getValue<std::string>(const std::string& key, const std::string& fallback) {
  5. if (values.find(key) != values.end()) {
  6. return values[key];
  7. }
  8. return fallback;
  9. }
  10. void Config::registerScriptInterface(sol::state &lua) {
  11. lua.new_usertype<Config>("config",
  12. "load_from_file", &Config::loadConfigFromFile,
  13. "get_value", &Config::getValue<std::string>,
  14. "set_value", &Config::setValue<std::string>);
  15. }