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

Method tableAt

vm.go:22–42  ·  view source on GitHub ↗
(t value, key value)

Source from the content-addressed store, hash-verified

20}
21
22func (l *State) tableAt(t value, key value) value {
23 for loop := 0; loop < maxTagLoop; loop++ {
24 var tm value
25 if table, ok := t.(*table); ok {
26 if result := table.at(key); result != nil {
27 return result
28 } else if tm = l.fastTagMethod(table.metaTable, tmIndex); tm == nil {
29 return nil
30 }
31 } else if tm = l.tagMethodByObject(t, tmIndex); tm == nil {
32 l.typeError(t, "index")
33 }
34 switch tm.(type) {
35 case closure, *goFunction:
36 return l.callTagMethod(tm, t, key)
37 }
38 t = tm
39 }
40 l.runtimeError("loop in table")
41 return nil
42}
43
44func (l *State) setTableAt(t value, key value, val value) {
45 for loop := 0; loop < maxTagLoop; loop++ {

Callers 5

GlobalMethod · 0.95
FieldMethod · 0.95
TableMethod · 0.95
executeSwitchMethod · 0.95
initFunction · 0.80

Calls 6

fastTagMethodMethod · 0.95
tagMethodByObjectMethod · 0.95
typeErrorMethod · 0.95
callTagMethodMethod · 0.95
runtimeErrorMethod · 0.95
atMethod · 0.80

Tested by

no test coverage detected