MCPcopy Index your code
hub / github.com/Shopify/go-lua / MathOpen

Function MathOpen

math.go:112–119  ·  view source on GitHub ↗

MathOpen opens the math library. Usually passed to Require.

(l *State)

Source from the content-addressed store, hash-verified

110
111// MathOpen opens the math library. Usually passed to Require.
112func MathOpen(l *State) int {
113 NewLibrary(l, mathLibrary)
114 l.PushNumber(3.1415926535897932384626433832795) // TODO use math.Pi instead? Values differ.
115 l.SetField(-2, "pi")
116 l.PushNumber(math.MaxFloat64)
117 l.SetField(-2, "huge")
118 return 1
119}

Callers

nothing calls this directly

Calls 3

NewLibraryFunction · 0.85
PushNumberMethod · 0.80
SetFieldMethod · 0.80

Tested by

no test coverage detected