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

Method CheckOption

auxlib.go:129–138  ·  view source on GitHub ↗
(n int, options []string)

Source from the content-addressed store, hash-verified

127}
128
129func (ls *LState) CheckOption(n int, options []string) int {
130 str := ls.CheckString(n)
131 for i, v := range options {
132 if v == str {
133 return i
134 }
135 }
136 ls.ArgError(n, fmt.Sprintf("invalid option: %s (must be one of %s)", str, strings.Join(options, ",")))
137 return 0
138}
139
140/* }}} */
141

Callers 5

TestCheckOptionFunction · 0.80
fileSeekFunction · 0.80
fileSetVBufFunction · 0.80
ioOpenFileFunction · 0.80
ioPopenFunction · 0.80

Calls 2

CheckStringMethod · 0.95
ArgErrorMethod · 0.95

Tested by 1

TestCheckOptionFunction · 0.64