(thread: Thread, index: number, userdata?: any)
| 20 | } |
| 21 | |
| 22 | public getValue(thread: Thread, index: number, userdata?: any): TableType { |
| 23 | // This is a map of Lua pointers to JS objects. |
| 24 | const seenMap: Map<number, TableType> = userdata || new Map() |
| 25 | const pointer = thread.lua.lua_topointer(thread.address, index) |
| 26 | |
| 27 | let table = seenMap.get(pointer) |
| 28 | if (!table) { |
| 29 | const keys = this.readTableKeys(thread, index) |
| 30 | |
| 31 | const isSequential = keys.length > 0 && keys.every((key, index) => key === String(index + 1)) |
| 32 | table = isSequential ? [] : {} |
| 33 | |
| 34 | seenMap.set(pointer, table) |
| 35 | this.readTableValues(thread, index, seenMap, table) |
| 36 | } |
| 37 | |
| 38 | return table |
| 39 | } |
| 40 | |
| 41 | public pushValue(thread: Thread, { target }: Decoration<TableType>, userdata?: Map<any, number>): boolean { |
| 42 | if (typeof target !== 'object' || target === null) { |
no test coverage detected