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

Method SetUserValue

lua.go:1134–1144  ·  view source on GitHub ↗

SetUserValue pops a table or nil from the stack and sets it as the new value associated to the userdata at index. http://www.lua.org/manual/5.2/manual.html#lua_setuservalue

(index int)

Source from the content-addressed store, hash-verified

1132//
1133// http://www.lua.org/manual/5.2/manual.html#lua_setuservalue
1134func (l *State) SetUserValue(index int) {
1135 l.checkElementCount(1)
1136 d := l.indexToValue(index).(*userData)
1137 if l.stack[l.top-1] == nil {
1138 d.env = nil
1139 } else {
1140 t := l.stack[l.top-1].(*table)
1141 d.env = t
1142 }
1143 l.top--
1144}
1145
1146// SetMetaTable pops a table from the stack and sets it as the new metatable
1147// for the value at index.

Callers 1

debug.goFile · 0.80

Calls 2

checkElementCountMethod · 0.95
indexToValueMethod · 0.95

Tested by

no test coverage detected