Skip to content

Commit

Permalink
Added a FlipTable helper
Browse files Browse the repository at this point in the history
  • Loading branch information
papa-smurf committed Dec 21, 2020
1 parent 100fd21 commit 067fe79
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Classes/Helpers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,16 @@ function App:tableMerge(left, right)
return left;
end

-- Simple table flip
function App:flipTable(Table)
local Flipped = {};
for key, value in pairs(Table) do
Flipped[value] = key;
end

return Flipped;
end

-- Get a table value by a given key. Use dot notation to traverse multiple levels e.g:
-- Settings.UI.Auctioneer.offsetX can be fetched using App:tableGet(myTable, "Settings.UI.Auctioneer.offsetX", 0)
-- without having to worry about tables or keys existing yes or no.
Expand Down

0 comments on commit 067fe79

Please sign in to comment.