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

Method setTableAt

vm.go:44–69  ·  view source on GitHub ↗
(t value, key value, val value)

Source from the content-addressed store, hash-verified

42}
43
44func (l *State) setTableAt(t value, key value, val value) {
45 for loop := 0; loop < maxTagLoop; loop++ {
46 var tm value
47 if table, ok := t.(*table); ok {
48 if table.tryPut(l, key, val) {
49 // previous non-nil value ==> metamethod irrelevant
50 table.invalidateTagMethodCache()
51 return
52 } else if tm = l.fastTagMethod(table.metaTable, tmNewIndex); tm == nil {
53 // no metamethod
54 table.put(l, key, val)
55 table.invalidateTagMethodCache()
56 return
57 }
58 } else if tm = l.tagMethodByObject(t, tmNewIndex); tm == nil {
59 l.typeError(t, "index")
60 }
61 switch tm.(type) {
62 case closure, *goFunction:
63 l.callTagMethodV(tm, t, key, val)
64 return
65 }
66 t = tm
67 }
68 l.runtimeError("loop in setTable")
69}
70
71func (l *State) objectLength(v value) value {
72 var tm value

Callers 5

SetFieldMethod · 0.95
SetGlobalMethod · 0.95
SetTableMethod · 0.95
executeSwitchMethod · 0.95
initFunction · 0.80

Calls 8

fastTagMethodMethod · 0.95
tagMethodByObjectMethod · 0.95
typeErrorMethod · 0.95
callTagMethodVMethod · 0.95
runtimeErrorMethod · 0.95
tryPutMethod · 0.80
putMethod · 0.80

Tested by

no test coverage detected