MCPcopy Create free account
hub / github.com/ceifa/wasmoon / getMetatableName

Method getMetatableName

src/thread.ts:252–269  ·  view source on GitHub ↗
(index: number)

Source from the content-addressed store, hash-verified

250 }
251
252 public getMetatableName(index: number): string | undefined {
253 const metatableNameType = this.lua.luaL_getmetafield(this.address, index, '__name')
254 if (metatableNameType === LuaType.Nil) {
255 return undefined
256 }
257
258 if (metatableNameType !== LuaType.String) {
259 // Pop the metafield if it's not a string
260 this.pop(1)
261 return undefined
262 }
263
264 const name = this.lua.lua_tolstring(this.address, -1, null)
265 // This is popping the luaL_getmetafield result which only pushes with type is not nil.
266 this.pop(1)
267
268 return name
269 }
270
271 public getValue(index: number, inputType?: LuaType, userdata?: unknown): any {
272 index = this.lua.lua_absindex(this.address, index)

Callers 2

setMetatableMethod · 0.95
getValueMethod · 0.95

Calls 1

popMethod · 0.95

Tested by

no test coverage detected