Thread Tools Display Modes
01-08-15, 12:33 PM   #1
10leej
A Molten Giant
 
10leej's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2011
Posts: 583
Multiple config files

Is it possible to use multiple config files in lua?
__________________
Tweets YouTube Website
  Reply With Quote
01-08-15, 01:24 PM   #2
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Yes.

10 char limit
  Reply With Quote
01-08-15, 05:18 PM   #3
Clamsoda
A Frostmaul Preserver
Join Date: Nov 2011
Posts: 269
All a file dedicated to configuration does it separate configurable settings from non-configurable/relevant code. The fact that the file is named config.lua or configuration.lua makes it no different than core.lua or MyAddon.lua or modules.lua etc.

Config1.lua:
Lua Code:
  1. local _, AddonTable = ...
  2.  
  3. AddonTable.Config1 = {
  4.     MyNeatSetting      = true,
  5.     MyNotSoNeatSetting = false
  6. }

Config2.lua
Lua Code:
  1. local _, AddonTable = ...
  2.  
  3. AddonTable.Config2 = {
  4.     DucksAreNeat = true,
  5.     CowsAreNeat  = false
  6. }

Understand that you can place anything you can place into a table, into the addon table. As such, you could split your configuration into 1000 files if you wanted to.
  Reply With Quote
01-08-15, 06:06 PM   #4
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,877
Now I'm confused.

Are we talking physical files on disk or multiple tables saved to a file?

I thought it was 1 global savedvariable file, one per character savedvariable file and each file could hold multiple config tables defined in the .TOC by sepreating their names with a comma.

If there is another option it would be interesting.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
01-08-15, 11:04 PM   #5
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Fizzlemizz View Post
I thought it was 1 global savedvariable file, one per character savedvariable file and each file could hold multiple config tables defined in the .TOC by sepreating their names with a comma.
I did not get the impression from the OP's post that he is talking about saved variables, but you are correct -- you only get up to 1 global saved variables file + 1 character saved variables file for each addon.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
01-09-15, 12:19 AM   #6
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,877
Originally Posted by Phanx View Post
I did not get the impression from the OP's post that he is talking about saved variables, but you are correct -- you only get up to 1 global saved variables file + 1 character saved variables file for each addon.
What other files can you create with WoW lua? I asume OP was talking about WoW lua and I know my knowledge is sketchy at best.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Multiple config files

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off