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

Method NewTypeMetatable

auxlib.go:318–327  ·  view source on GitHub ↗

* }}} */ * metatable operations {{{ */

(typ string)

Source from the content-addressed store, hash-verified

316/* metatable operations {{{ */
317
318func (ls *LState) NewTypeMetatable(typ string) *LTable {
319 regtable := ls.Get(RegistryIndex)
320 mt := ls.GetField(regtable, typ)
321 if tb, ok := mt.(*LTable); ok {
322 return tb
323 }
324 mtnew := ls.NewTable()
325 ls.SetField(regtable, typ, mtnew)
326 return mtnew
327}
328
329func (ls *LState) GetMetaField(obj LValue, event string) LValue {
330 return ls.metaOp1(obj, event)

Callers 1

OpenIoFunction · 0.80

Calls 4

GetMethod · 0.95
GetFieldMethod · 0.95
NewTableMethod · 0.95
SetFieldMethod · 0.95

Tested by

no test coverage detected