Module:auto-subtable

From Wiktionary, the free dictionary
Jump to navigation Jump to search

This module needs documentation.
Please document this module by describing its purpose and usage on the documentation page.

local auto_subtable_mt = {
	__index = function(self, key)
		local val = {}
		self[key] = val
		return val
	end
}
local function un_auto_subtable(t)
	t.un_auto_subtable = nil
	return setmetatable(t, nil)
end

return function(t)
	t = t or {}
	
	t.un_auto_subtable = un_auto_subtable
	
	return setmetatable(t, auto_subtable_mt)
end