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

Method ToInt64

state.go:1672–1682  ·  view source on GitHub ↗
(n int)

Source from the content-addressed store, hash-verified

1670}
1671
1672func (ls *LState) ToInt64(n int) int64 {
1673 if lv, ok := ls.Get(n).(LNumber); ok {
1674 return int64(lv)
1675 }
1676 if lv, ok := ls.Get(n).(LString); ok {
1677 if num, err := parseNumber(string(lv)); err == nil {
1678 return int64(num)
1679 }
1680 }
1681 return 0
1682}
1683
1684func (ls *LState) ToNumber(n int) LNumber {
1685 return LVAsNumber(ls.Get(n))

Callers 1

TestToInt64Function · 0.45

Calls 2

GetMethod · 0.95
parseNumberFunction · 0.85

Tested by 1

TestToInt64Function · 0.36