added patrol lua function