(thread: Thread, decoratedValue: Decoration<any, ProxyDecorationOptions>)
| 136 | } |
| 137 | |
| 138 | public pushValue(thread: Thread, decoratedValue: Decoration<any, ProxyDecorationOptions>): boolean { |
| 139 | const { target, options } = decoratedValue |
| 140 | if (options.proxy === undefined) { |
| 141 | if (target === null || target === undefined) { |
| 142 | return false |
| 143 | } |
| 144 | |
| 145 | if (typeof target !== 'object') { |
| 146 | const isClass = |
| 147 | typeof target === 'function' && target.prototype?.constructor === target && target.toString().startsWith('class ') |
| 148 | |
| 149 | if (!isClass) { |
| 150 | return false |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | if (isPromise(target)) { |
| 155 | return false |
| 156 | } |
| 157 | } else if (options.proxy === false) { |
| 158 | return false |
| 159 | } |
| 160 | |
| 161 | if (options.metatable && !(options.metatable instanceof Decoration)) { |
| 162 | // Otherwise the metatable will get converted into a JS ref rather than being set as a standard |
| 163 | // table. This forces it to use the standard table type. |
| 164 | decoratedValue.options.metatable = decorateProxy(options.metatable, { proxy: false }) |
| 165 | return false |
| 166 | } |
| 167 | |
| 168 | return super.pushValue(thread, decoratedValue) |
| 169 | } |
| 170 | |
| 171 | public close(): void { |
| 172 | this.thread.lua.module.removeFunction(this.gcPointer) |
no test coverage detected