Move old Lua functions to compat.lua