mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-01 17:38:41 +00:00
Add table.key_value_swap (#9248)
This commit is contained in:
parent
3ad92baa9c
commit
f9c7e46a34
2 changed files with 11 additions and 0 deletions
|
@ -575,6 +575,15 @@ function table.insert_all(t, other)
|
|||
end
|
||||
|
||||
|
||||
function table.key_value_swap(t)
|
||||
local ti = {}
|
||||
for k,v in pairs(t) do
|
||||
ti[v] = k
|
||||
end
|
||||
return ti
|
||||
end
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- mainmenu only functions
|
||||
--------------------------------------------------------------------------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue