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

Method SetTable

lua.go:1098–1102  ·  view source on GitHub ↗

SetTable does the equivalent of table[key]=v, where table is the value at index, v is the value at the top of the stack and key is the value just below the top. The function pops both the key and the value from the stack. As in Lua, this function may trigger a metamethod for the __newindex event.

(index int)

Source from the content-addressed store, hash-verified

1096//
1097// http://www.lua.org/manual/5.2/manual.html#lua_settable
1098func (l *State) SetTable(index int) {
1099 l.checkElementCount(2)
1100 l.setTableAt(l.indexToValue(index), l.stack[l.top-2], l.stack[l.top-1])
1101 l.top -= 2
1102}
1103
1104// RawSet is similar to SetTable, but does a raw assignment (without
1105// metamethods).

Callers 1

TestTableNextFunction · 0.95

Calls 3

checkElementCountMethod · 0.95
setTableAtMethod · 0.95
indexToValueMethod · 0.95

Tested by 1

TestTableNextFunction · 0.76