Move 17 old Lua functions to compat.lua