-- Coerce T to be a table. -- If T is a table, return it. If not, return a blank table. function table.coerce(t) if type(t) == "table" then return t else return {} end end -- Clear the table out. Deletes all keys, removes any metatable. -- TODO: this doesn't work on tables that have __metatable metamethod. function table.rawclear(t) for k in pairs(t) do rawset(t, k, nil) end setmetatable(t, nil) return t end