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

Method OptString

auxlib.go:180–190  ·  view source on GitHub ↗
(n int, d string)

Source from the content-addressed store, hash-verified

178}
179
180func (ls *LState) OptString(n int, d string) string {
181 v := ls.Get(n)
182 if v == LNil {
183 return d
184 }
185 if lv, ok := v.(LString); ok {
186 return string(lv)
187 }
188 ls.TypeError(n, LTString)
189 return ""
190}
191
192func (ls *LState) OptBool(n int, d bool) bool {
193 v := ls.Get(n)

Callers 6

baseAssertFunction · 0.80
baseLoadFunction · 0.80
baseLoadStringFunction · 0.80
TestOptStringFunction · 0.80
debugGetInfoFunction · 0.80
tableConcatFunction · 0.80

Calls 2

GetMethod · 0.95
TypeErrorMethod · 0.95

Tested by 1

TestOptStringFunction · 0.64