MCPcopy Create free account
hub / github.com/yuin/gopher-lua / OptInt64

Method OptInt64

auxlib.go:156–166  ·  view source on GitHub ↗
(n int, d int64)

Source from the content-addressed store, hash-verified

154}
155
156func (ls *LState) OptInt64(n int, d int64) int64 {
157 v := ls.Get(n)
158 if v == LNil {
159 return d
160 }
161 if intv, ok := v.(LNumber); ok {
162 return int64(intv)
163 }
164 ls.TypeError(n, LTNumber)
165 return 0
166}
167
168func (ls *LState) OptNumber(n int, d LNumber) LNumber {
169 v := ls.Get(n)

Callers 1

TestOptInt64Function · 0.80

Calls 2

GetMethod · 0.95
TypeErrorMethod · 0.95

Tested by 1

TestOptInt64Function · 0.64