Bagnon

Bagnon

122M Downloads

trying to enable per-character settings errors out

TanerH opened this issue ยท 4 comments

commented

If I try to enable "Per-Character settings", I get an error in the "Wildpands" library, complaining that a table was passed to 'GetOwnerAddress' and therefore the strmatch() blows up.

I printed the table that was passed in, and I can't understand where it's coming from, to be honest...

But the Bagnon_Config seems to call SetProfile() (which calls GetOwnerID, which calls GetOwnerAddress).. but I haven't spent any actual time trying to figure out what your code does...

Hopefully this will be a "oops, duh" sort of fix? :-)

commented

In examining this we see the error as follows:
...Wildpants\libs\LibItemCache-2.0\LibItemCache-2.0.lua:179: GetOwnerAddress()
...Wildpants\libs\LibItemCache-2.0\LibItemCache-2.0.lua:185: GetOwnerID()
...e\AddOns\Bagnon\external\Wildpants\core\settings.lua:162: SetProfile()
Bagnon_Config\common\panels.lua:20:
Bagnon_Config\common\panels.lua:19
Bagnon_Config\common\panels.lua:54: call()

So we start looking from 54 in panels, since before that in the stack it is normal button pieces:

			SetProfile(CopyTable(Addon.sets.global))

So the table is coming from the standard global set, which a quick look in settings at line 99 we see:

		global = SetDefaults({}, ProfileDefaults),

Next wee see 19 and 20, also in panels:

local SetProfile = function(profile)
	Addon:SetProfile(profile)

Then 161-163 in settings for wildpants:

function Addon:SetProfile(owner, profile)
	self.sets.owners[Cache:GetOwnerID(owner)] = profile and SetDefaults(profile, ProfileDefaults)
end

Thus the error lies in how things are being called, essentially Panels is calling a SetProfile function and only passing the profile table in, however the SetProfile function in settings has both an Owner and a Profile variable able to be passed, however since only one argument was passed it assigns the default profile table to the 'owner' variable and profile is treated as null.

If I had to guess I would say that the order of owner and profile in the settings.lua function declaration is supposed to be swapped so the owner value is nil as it passes to the getownerid, which would then return the players realm and player.

commented

oops, duh

commented

Comicus, the quick-fix is to do what Torsin said, and swap the parameter order in the function definition for SetProfile() in settings.lua in the Wildpants extra...

More specifically, the file:

Bagnon\external\Wildpants\core\settings.lua

on line 161, swap the words "owner" and "profile", so that the line looks like this:

function Addon:SetProfile(profile, owner)

I did this earlier, and things seem to work fine so far...

commented

I seem to be having the same issue now:

4x ...Wildpants\libs\LibItemCache-2.0\LibItemCache-2.0-4.lua:179: bad argument #1 to 'strmatch' (string expected, got table)
[C]: in function strmatch' ...Wildpants\libs\LibItemCache-2.0\LibItemCache-2.0-4.lua:179: in function GetOwnerAddress'
...Wildpants\libs\LibItemCache-2.0\LibItemCache-2.0-4.lua:185: in function GetOwnerID' ...eBagnon\external\Wildpants\core\settings-Settings.lua:162: in function SetProfile'
Bagnon_Config\common\panels.lua:20: in function <Bagnon_Config\common\panels.lua:19>
Bagnon_Config\common\panels.lua:54: in function call' ...Config\common\libs\Sushi-3.0\Classes\CallHandler.lua:55: in function FireCall'
...Config\common\libs\Sushi-3.0\Classes\CheckButton.lua:58: in function <...Config\common\libs\Sushi-3.0\Classes\CheckButton.lua:49>

Locals:
(*temporary) =

{
vault =
{
}
inventory =
{
}
guild =
{
}
bank =
{
}
}
(*temporary) = "^(.-) *%- *(%S+)$"
(*temporary) = "string expected, got table"

Only when I try to set character specific setting