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

Method readTableKeys

src/type-extensions/table.ts:94–107  ·  view source on GitHub ↗
(thread: Thread, index: number)

Source from the content-addressed store, hash-verified

92 }
93
94 private readTableKeys(thread: Thread, index: number): string[] {
95 const keys = []
96
97 thread.lua.lua_pushnil(thread.address)
98 while (thread.lua.lua_next(thread.address, index)) {
99 // JS only supports string keys in objects.
100 const key = thread.indexToString(-2)
101 keys.push(key)
102 // Pop the value.
103 thread.pop()
104 }
105
106 return keys
107 }
108
109 private readTableValues(thread: Thread, index: number, seenMap: Map<number, TableType>, table: TableType): void {
110 const isArray = Array.isArray(table)

Callers 1

getValueMethod · 0.95

Calls 2

indexToStringMethod · 0.80
popMethod · 0.80

Tested by

no test coverage detected