-- http://lua-users.org/wiki/InheritanceTutorial

function merge_table( baseClass, newClass )
	for k, v in pairs( baseClass ) do
		if type( v ) == "table" then
			newClass[ k ] = newClass[ k ] or {}
			merge_table( v, newClass[ k ] )
		else
			newClass[ k ] = v
		end
	end
end

function inherit_table( baseClass )
	local newClass = {}
	merge_table( baseClass, newClass )
	return newClass
end