Move more old Lua functions to compat.lua