How am I able to get a specific variable in the config of another plugin?
Solved Getting config from other plugins
Discussion in 'Rust Development' started by LaserHydra, Jun 4, 2015.
-
You don't, unless it's exposed by the other plugin that allows you to get that value.
-
-
Code:local externalData function PLUGIN:LoadExternalConfig() local configPath = self.Plugin.Manager.ConfigPath local fileName = configPath .. "/configfile.json" local externalConfig = new(self.Plugin.Config:GetType(), nil) externalConfig:Load(fileName) externalData = externalConfig end
-
-
Sheesh, such nonsense for easy stuff...
Code:private object GetConfigVarFromPlugin(string pluginName, params string[] configKeyPath) { foreach (var p in Manager.GetPlugins()) { if (p.Name == pluginName) { if (p.HasConfig && p.Config != null) return p.Config.Get(configKeyPath); } } return null; }
Code:Puts(GetConfigVarFromPlugin("m-GatherRate", "Settings", "ChatName").ToString());
-
already solved though, and not needed anymore.
Still thanks, may be useful another time