MCPcopy Index your code
hub / github.com/yuin/gopher-lua / SetMetatable

Method SetMetatable

state.go:2124–2139  ·  view source on GitHub ↗
(obj LValue, mt LValue)

Source from the content-addressed store, hash-verified

2122}
2123
2124func (ls *LState) SetMetatable(obj LValue, mt LValue) {
2125 switch mt.(type) {
2126 case *LNilType, *LTable:
2127 default:
2128 ls.RaiseError("metatable must be a table or nil, but got %v", mt.Type().String())
2129 }
2130
2131 switch v := obj.(type) {
2132 case *LTable:
2133 v.Metatable = mt
2134 case *LUserData:
2135 v.Metatable = mt
2136 default:
2137 ls.G.builtinMts[int(obj.Type())] = mt
2138 }
2139}
2140
2141/* }}} */
2142

Callers 7

loSeeAllFunction · 0.45
baseSetMetatableFunction · 0.45
baseNewProxyFunction · 0.45
newFileFunction · 0.45
newProcessFunction · 0.45
debugSetMetatableFunction · 0.45
TestObjLenFunction · 0.45

Calls 3

RaiseErrorMethod · 0.95
StringMethod · 0.65
TypeMethod · 0.65

Tested by 1

TestObjLenFunction · 0.36