Move old party Lua functions to compat
Fix issue #322
Use [] instead of at to skip bounds checking
merge conflicts