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

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