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

Method ToInteger

lua.go:769–774  ·  view source on GitHub ↗

ToInteger converts the Lua value at index into a signed integer. The Lua value must be a number, or a string convertible to a number. If the number is not an integer, it is truncated in some non-specified way. If the operation failed, the second return value will be false. http://www.lua.org/manu

(index int)

Source from the content-addressed store, hash-verified

767//
768// http://www.lua.org/manual/5.2/manual.html#lua_tointegerx
769func (l *State) ToInteger(index int) (int, bool) {
770 if n, ok := l.toNumber(l.indexToValue(index)); ok {
771 return int(n), true
772 }
773 return 0, false
774}
775
776// ToUnsigned converts the Lua value at index to a Go uint. The Lua value
777// must be a number or a string convertible to a number.

Callers 4

readLineFunction · 0.80
CheckIntegerFunction · 0.80
LengthExFunction · 0.80
fieldFunction · 0.80

Calls 2

toNumberMethod · 0.95
indexToValueMethod · 0.95

Tested by

no test coverage detected