Module:auto-subtable

From Linguifex
Jump to navigation Jump to search

Documentation for this module may be created at Module:auto-subtable/doc

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