Skip to content

WipeCharacterTable/WipeGuildTable: skip non-table inputs#11

Open
kilick wants to merge 1 commit into
Thaoky:developmentfrom
kilick:fix-wipe-database-type-safety
Open

WipeCharacterTable/WipeGuildTable: skip non-table inputs#11
kilick wants to merge 1 commit into
Thaoky:developmentfrom
kilick:fix-wipe-database-type-safety

Conversation

@kilick
Copy link
Copy Markdown

@kilick kilick commented May 26, 2026

Clicking Wipe Database in the Altoholic Summary crashes with bad argument #1 to 'pairs' (table expected, got function) from DataStore.lua:382.

ClearAllData iterates the registered modules and passes moduleDB.Characters / .Guilds into the wipe helpers. For some modules these resolve to a function (via the DataStore method metatable), so the existing if not t then return end guard passes through and pairs(t) then errors.

Using a type(t) ~= "table" check instead lets non-table values fall through silently, which matches the original intent for "no character table on this module."

Fixes Thaoky/Altoholic_Retail#33.

ClearAllData and DeleteGuild iterate registered modules and pass
moduleDB.Characters / .Guilds to WipeCharacterTable / WipeGuildTable.
For some modules these references resolve to a function (via the
DataStore method metatable), which then crashes pairs() with
'bad argument Thaoky#1 to pairs (table expected, got function)'.

Use a type check instead of a truthiness check so non-table inputs
are silently skipped, matching the original intent for missing keys.

Fixes Altoholic_Retail#33.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant