MCPcopy Index your code
hub / github.com/Shopify/go-lua / Compare

Method Compare

lua.go:745–759  ·  view source on GitHub ↗

Compare compares two values. http://www.lua.org/manual/5.2/manual.html#lua_compare

(index1, index2 int, op ComparisonOperator)

Source from the content-addressed store, hash-verified

743//
744// http://www.lua.org/manual/5.2/manual.html#lua_compare
745func (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.

Callers 1

LessMethod · 0.80

Calls 4

indexToValueMethod · 0.95
equalObjectsMethod · 0.95
lessThanMethod · 0.95
lessOrEqualMethod · 0.95

Tested by

no test coverage detected