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

Function OptString

auxiliary.go:327–332  ·  view source on GitHub ↗

OptString returns the string at index if it is a string. If this argument is absent or is nil, returns def. Otherwise, raises an error.

(l *State, index int, def string)

Source from the content-addressed store, hash-verified

325// OptString returns the string at index if it is a string. If this argument is
326// absent or is nil, returns def. Otherwise, raises an error.
327func OptString(l *State, index int, def string) string {
328 if l.IsNoneOrNil(index) {
329 return def
330 }
331 return CheckString(l, index)
332}
333
334func CheckNumber(l *State, index int) float64 {
335 n, ok := l.ToNumber(index)

Callers 7

base.goFile · 0.85
string.goFile · 0.85
table.goFile · 0.85
io.goFile · 0.85
load.goFile · 0.85
CheckOptionFunction · 0.85
os.goFile · 0.85

Calls 2

CheckStringFunction · 0.85
IsNoneOrNilMethod · 0.80

Tested by

no test coverage detected