(luaCode: string, name?: string)
| 53 | } |
| 54 | |
| 55 | public loadString(luaCode: string, name?: string): void { |
| 56 | const size = this.lua.module.lengthBytesUTF8(luaCode) |
| 57 | const pointerSize = size + 1 |
| 58 | const bufferPointer = this.lua.module._malloc(pointerSize) |
| 59 | try { |
| 60 | this.lua.module.stringToUTF8(luaCode, bufferPointer, pointerSize) |
| 61 | this.assertOk(this.lua.luaL_loadbufferx(this.address, bufferPointer, size, name ?? bufferPointer, null)) |
| 62 | } finally { |
| 63 | this.lua.module._free(bufferPointer) |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | public loadFile(filename: string): void { |
| 68 | this.assertOk(this.lua.luaL_loadfilex(this.address, filename, null)) |
no test coverage detected