ToUnsigned converts the Lua value at index to a Go uint. The Lua value must be a number or a string convertible to a number. If the number is not an unsigned integer, it is truncated in some non-specified way. If the number is outside the range of uint, it is normalized to the remainder of its div
(index int)
| 785 | // |
| 786 | // http://www.lua.org/manual/5.2/manual.html#lua_tounsignedx |
| 787 | func (l *State) ToUnsigned(index int) (uint, bool) { |
| 788 | if n, ok := l.toNumber(l.indexToValue(index)); ok { |
| 789 | const supUnsigned = float64(^uint32(0)) + 1 |
| 790 | return uint(n - math.Floor(n/supUnsigned)*supUnsigned), true |
| 791 | } |
| 792 | return 0, false |
| 793 | } |
| 794 | |
| 795 | // ToString converts the Lua value at index to a Go string. The Lua value |
| 796 | // must also be a string or a number; otherwise the function returns |
no test coverage detected