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

Method CheckNumber

auxlib.go:38–50  ·  view source on GitHub ↗
(n int)

Source from the content-addressed store, hash-verified

36}
37
38func (ls *LState) CheckNumber(n int) LNumber {
39 v := ls.Get(n)
40 if lv, ok := v.(LNumber); ok {
41 return lv
42 }
43 if lv, ok := v.(LString); ok {
44 if num, err := parseNumber(string(lv)); err == nil {
45 return num
46 }
47 }
48 ls.TypeError(n, LTNumber)
49 return 0
50}
51
52func (ls *LState) CheckString(n int) string {
53 v := ls.Get(n)

Callers 15

TestCheckNumberFunction · 0.80
mathAbsFunction · 0.80
mathAcosFunction · 0.80
mathAsinFunction · 0.80
mathAtanFunction · 0.80
mathAtan2Function · 0.80
mathCeilFunction · 0.80
mathCosFunction · 0.80
mathCoshFunction · 0.80
mathDegFunction · 0.80
mathExpFunction · 0.80
mathFloorFunction · 0.80

Calls 3

GetMethod · 0.95
TypeErrorMethod · 0.95
parseNumberFunction · 0.85

Tested by 1

TestCheckNumberFunction · 0.64