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

Function CheckOption

auxiliary.go:405–419  ·  view source on GitHub ↗
(l *State, index int, def string, list []string)

Source from the content-addressed store, hash-verified

403}
404
405func CheckOption(l *State, index int, def string, list []string) int {
406 var name string
407 if def == "" {
408 name = OptString(l, index, def)
409 } else {
410 name = CheckString(l, index)
411 }
412 for i, s := range list {
413 if name == s {
414 return i
415 }
416 }
417 ArgumentError(l, index, l.PushFString("invalid option '%s'", name))
418 panic("unreachable")
419}
420
421func SubTable(l *State, index int, name string) bool {
422 l.Field(index, name)

Callers 1

io.goFile · 0.85

Calls 4

OptStringFunction · 0.85
CheckStringFunction · 0.85
ArgumentErrorFunction · 0.85
PushFStringMethod · 0.80

Tested by

no test coverage detected