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

Method OptFunction

auxlib.go:216–226  ·  view source on GitHub ↗
(n int, d *LFunction)

Source from the content-addressed store, hash-verified

214}
215
216func (ls *LState) OptFunction(n int, d *LFunction) *LFunction {
217 v := ls.Get(n)
218 if v == LNil {
219 return d
220 }
221 if lv, ok := v.(*LFunction); ok {
222 return lv
223 }
224 ls.TypeError(n, LTFunction)
225 return nil
226}
227
228func (ls *LState) OptUserData(n int, d *LUserData) *LUserData {
229 v := ls.Get(n)

Callers 1

TestOptFunctionFunction · 0.80

Calls 2

GetMethod · 0.95
TypeErrorMethod · 0.95

Tested by 1

TestOptFunctionFunction · 0.64