The following will work for you. The @ is for array of arguments. : means at. $# is the length of the array of arguments.
- @ is for array of arguments.
- : means at
- $# is the length of the array of arguments.
So the result is the last element:
${@:$#}
Example:
function afunction{
echo ${@:$#}
}
afunction -d -o local 50
#Outputs 50
Note that this is bash-only.