utils.lua: Add an inherits function to ease OO development

This will get used in #1719 to implement lua-side hyper{drive, space,
jump}.