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

Method CheckChannel

auxlib.go:441–448  ·  view source on GitHub ↗

Checks whether the given index is an LChannel and returns this channel.

(n int)

Source from the content-addressed store, hash-verified

439
440// Checks whether the given index is an LChannel and returns this channel.
441func (ls *LState) CheckChannel(n int) chan LValue {
442 v := ls.Get(n)
443 if ch, ok := v.(LChannel); ok {
444 return (chan LValue)(ch)
445 }
446 ls.TypeError(n, LTChannel)
447 return nil
448}
449
450// If the given index is a LChannel, returns this channel. If this argument is absent or is nil, returns ch. Otherwise, raises an error.
451func (ls *LState) OptChannel(n int, ch chan LValue) chan LValue {

Callers 2

TestCheckChannelFunction · 0.80
checkChannelFunction · 0.80

Calls 2

GetMethod · 0.95
TypeErrorMethod · 0.95

Tested by 1

TestCheckChannelFunction · 0.64