Compare compares two values. http://www.lua.org/manual/5.2/manual.html#lua_compare
(index1, index2 int, op ComparisonOperator)
| 743 | // |
| 744 | // http://www.lua.org/manual/5.2/manual.html#lua_compare |
| 745 | func (l *State) Compare(index1, index2 int, op ComparisonOperator) bool { |
| 746 | if o1, o2 := l.indexToValue(index1), l.indexToValue(index2); o1 != nil && o2 != nil { |
| 747 | switch op { |
| 748 | case OpEq: |
| 749 | return l.equalObjects(o1, o2) |
| 750 | case OpLT: |
| 751 | return l.lessThan(o1, o2) |
| 752 | case OpLE: |
| 753 | return l.lessOrEqual(o1, o2) |
| 754 | default: |
| 755 | panic("invalid option") |
| 756 | } |
| 757 | } |
| 758 | return false |
| 759 | } |
| 760 | |
| 761 | // ToInteger converts the Lua value at index into a signed integer. The Lua |
| 762 | // value must be a number, or a string convertible to a number. |
no test coverage detected