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

Function MetaField

auxiliary.go:82–94  ·  view source on GitHub ↗

MetaField pushes onto the stack the field event from the metatable of the object at index. If the object does not have a metatable, or if the metatable does not have this field, returns false and pushes nothing.

(l *State, index int, event string)

Source from the content-addressed store, hash-verified

80// object at index. If the object does not have a metatable, or if the
81// metatable does not have this field, returns false and pushes nothing.
82func MetaField(l *State, index int, event string) bool {
83 if !l.MetaTable(index) {
84 return false
85 }
86 l.PushString(event)
87 l.RawGet(-2)
88 if l.IsNil(-1) {
89 l.Pop(2) // remove metatable and metafield
90 return false
91 }
92 l.Remove(-2) // remove only metatable
93 return true
94}
95
96// CallMeta calls a metamethod.
97//

Callers 3

pairsFunction · 0.85
base.goFile · 0.85
CallMetaFunction · 0.85

Calls 6

MetaTableMethod · 0.80
PushStringMethod · 0.80
RawGetMethod · 0.80
IsNilMethod · 0.80
PopMethod · 0.80
RemoveMethod · 0.80

Tested by

no test coverage detected