MCPcopy Index your code
hub / github.com/yuin/gopher-lua / ToInt

Method ToInt

_state.go:1447–1457  ·  view source on GitHub ↗
(n int)

Source from the content-addressed store, hash-verified

1445}
1446
1447func (ls *LState) ToInt(n int) int {
1448 if lv, ok := ls.Get(n).(LNumber); ok {
1449 return int(lv)
1450 }
1451 if lv, ok := ls.Get(n).(LString); ok {
1452 if num, err := parseNumber(string(lv)); err == nil {
1453 return int(num)
1454 }
1455 }
1456 return 0
1457}
1458
1459func (ls *LState) ToInt64(n int) int64 {
1460 if lv, ok := ls.Get(n).(LNumber); ok {

Callers

nothing calls this directly

Calls 2

GetMethod · 0.95
parseNumberFunction · 0.85

Tested by

no test coverage detected