chat_formspec-redo/context.lua
2024-02-12 22:01:13 +01:00

15 lines
414 B
Lua

-- https://rubenwardy.com/minetest_modding_book/en/players/formspecs.html#contexts
local _contexts = {}
function chat_formspec.get_context(name)
local context = _contexts[name] or {}
_contexts[name] = context
return context
end
function chat_formspec.delete_context(name)
_contexts[name] = nil
end
minetest.register_on_leaveplayer(function(player)
clear_context(player:get_player_name())
end)