Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/lualib/Await.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import { __TS__Promise } from "./Promise";

const coroutine = _G.coroutine ?? {};
const cocreate = coroutine.create;
const coresume = coroutine.resume;
const costatus = coroutine.status;
Expand Down
11 changes: 11 additions & 0 deletions test/unit/builtins/loading.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,17 @@ test("lualib should not include tstl header", () => {
);
});

test("using lualib does not crash when coroutine is not defined", () => {
util.testModule`
declare const _G: any;
declare function require(this: void, name: string): any

_G.coroutine = undefined;
require("lualib_bundle");
export const result = 1
`.expectToEqual({ result: 1 });
});

describe("Unknown builtin property", () => {
test("access", () => {
util.testExpression`Math.unknownProperty`
Expand Down