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

Method readTableValues

src/type-extensions/table.ts:109–125  ·  view source on GitHub ↗
(thread: Thread, index: number, seenMap: Map<number, TableType>, table: TableType)

Source from the content-addressed store, hash-verified

107 }
108
109 private readTableValues(thread: Thread, index: number, seenMap: Map<number, TableType>, table: TableType): void {
110 const isArray = Array.isArray(table)
111
112 thread.lua.lua_pushnil(thread.address)
113 while (thread.lua.lua_next(thread.address, index)) {
114 const key = thread.indexToString(-2)
115 const value = thread.getValue(-1, undefined, seenMap)
116
117 if (isArray) {
118 table.push(value)
119 } else {
120 table[key] = value
121 }
122
123 thread.pop()
124 }
125 }
126}
127
128export default function createTypeExtension(thread: Global): TypeExtension<any> {

Callers 1

getValueMethod · 0.95

Calls 3

indexToStringMethod · 0.80
popMethod · 0.80
getValueMethod · 0.45

Tested by

no test coverage detected