Is it possible to edit another config (not the default one of the plugin) using the existing configuration system.
If, then how?
Not possible? - Another solution to edit and read from those properly?
Docs aren't giving me the information I need.
sincerely
#Edit thanks to Hatemail, I'm working in C# / LUA, Javascript is also fine.
Edit default config of Plugin A using Plugin B
Discussion in 'Rust Development' started by Pwnographyz, Feb 16, 2015.
-
It's possible, if your looking for code samples you'll need to provide the language your working in.
-
I'm working in C# / LUA, Javascript is also fine.
-
you can create a hook in the target plugin that changes a config from the parameters of the hook.
then just call the hook from the source plugin. -
basic code example?
-
I'll be home in 3 hours and I can provided some if no one else does.
[DOUBLEPOST=1424138124,1424121614][/DOUBLEPOST]I must ask why you want to modify the config of another plugin? If you need to share data between plugins using the datafile system is the preferred way.
Lua is a crapshoot for loading the config of another plugin and trying to modify it :/
Lua
Code:function PLUGIN:Init () local configPath = self.Plugin.Manager.ConfigPath local fileName = configPath .. "/test.json" local config = new( self.Plugin.Config:GetType(), nil) -- Make a new DynamicConfigFile object config:Load(fileName) --Load from the oxide config dir config["Test"] = "hahaha" --Set Values config:Save(fileName) -- Save it end
Code:DynamicConfigFile config = new DynamicConfigFile(); String fileName = Manager.ConfigPath + "/test.json"; config.Load(fileName); config["Test2"] = "tsest2"; config.Save(fileName);
-
I really need this in Javascript? Anyone?