X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FMoof%2FSettings.hh;h=d31b57dcf763c2fe0d38b1f3f96cc1fa24583223;hp=2a2a9267026e5475ddd5c0a1d11433da19767251;hb=b357615aba1dbde81e3c6999366604e6001010a7;hpb=246d7d6e4386b686327163d621c7c8b398b7d479 diff --git a/src/Moof/Settings.hh b/src/Moof/Settings.hh index 2a2a926..d31b57d 100644 --- a/src/Moof/Settings.hh +++ b/src/Moof/Settings.hh @@ -50,12 +50,10 @@ class Settings { public: - Settings() : - mGlobals(mScript.getGlobalTable()), - mTop(mScript[-1]) + Settings() { mScript.importBaseLibrary(); - importLogPrintFunction(mScript); + importLogFunctions(mScript); } ~Settings(); @@ -79,7 +77,6 @@ public: private: Script mScript; - Script::Slot mGlobals, mTop; std::string mUserFile; }; @@ -88,17 +85,20 @@ private: template bool Settings::get(const std::string& key, T& value) { + Script::Slot top = mScript[-1]; + Script::Slot globals = mScript.getGlobalTable(); + std::vector fields; boost::split(fields, key, boost::is_any_of(".")); - mGlobals.pushCopy(); + globals.pushCopy(); std::vector::iterator it; for (it = fields.begin(); it != fields.end(); ++it) { - if (mTop.isTable()) + if (top.isTable()) { - mTop.pushField(*it); + top.pushField(*it); } else { @@ -107,7 +107,7 @@ bool Settings::get(const std::string& key, T& value) } } - bool got = mTop.get(value); + bool got = top.get(value); mScript.clear(); return got; }