Skip to content

Commit 7810eb6

Browse files
committed
Add warning about inaccurate execution results in playground for other targets
1 parent 7d3d6c8 commit 7810eb6

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

Diff for: src/pages/play/Playground.tsx

+9-1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ function EditorContextProvider({ children }: { children: React.ReactNode }) {
6767

6868
setState({ source, target, lua, ast, sourceMap, results: [] });
6969
const results = await executeLua(lua);
70+
if (target !== LuaTarget.Lua54) {
71+
results.unshift({
72+
method: "warning",
73+
data: ["Web execution expects Lua 5.4 and might not work for other targets"],
74+
});
75+
}
7076
setState({ source, target, lua, ast, sourceMap, results });
7177
}, []);
7278

@@ -107,7 +113,6 @@ function InputPane({ onWorkerSet }: { onWorkerSet(updateTarget: (target: LuaTarg
107113
onWorkerSet((newTarget) => {
108114
target = newTarget;
109115
updateInputs(myEditor?.getModel()?.getValue() ?? "", newTarget);
110-
updateModel(myWorker!, editor.getModel()!, newTarget);
111116
});
112117
};
113118

@@ -192,6 +197,9 @@ function consoleOutputRowClass(data: ConsoleMessage) {
192197
if (data.method === "error") {
193198
rowClass += " " + styles.luaOutputTerminalError;
194199
}
200+
if (data.method === "warning") {
201+
rowClass += " " + styles.luaOutputTerminalWarning;
202+
}
195203

196204
return rowClass;
197205
}

Diff for: src/pages/play/styles.module.scss

+7
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,13 @@ $output-height: 180px;
123123
border-bottom: 1px solid rgb(91, 0, 0);
124124
}
125125

126+
.luaOutputTerminalWarning {
127+
color: rgb(254, 188, 127);
128+
background-color: rgb(53, 49, 0);
129+
border-top: 1px solid rgb(85, 83, 0);
130+
border-bottom: 1px solid rgb(91, 62, 0);
131+
}
132+
126133
.playgroundTarget {
127134
float: left;
128135
}

0 commit comments

Comments
 (0)