Skip to content

Commit

Permalink
Version 1.79
Browse files Browse the repository at this point in the history
Protect against native JS exceptions from Fengari-lua
  • Loading branch information
d0sboots committed Jul 5, 2024
1 parent 64f6751 commit 44c5da3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ <h2 class="settings">Settings</h2>

<div class="editor-info">
<div>
<span class="infotext">Editor: 1.78 ─ Game: v0.47.1</span>
<span class="infotext">Editor: 1.79 ─ Game: v0.47.1</span>
<br/>
<span id="warning" class="infotext warning">Cannot access Local Storage. Scripts will not save!</span>
<a id="compression" class="infotext warning" target="_blank" style="display:none" href="old_browser.html">
Expand Down
8 changes: 8 additions & 0 deletions main.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
DEBUG = not fengari
package.path = "scripts/?.lua"
js = nil
if fengari then
js = require "js"
end

local line_number
local compile_file
Expand Down Expand Up @@ -34,6 +38,10 @@ do
status, ret = pcall(compile, pair.name, pair.text, arg2)
if not status then
assert = assert_old
if js then
-- Fengari has bugs where it can return a native JS exception object
ret = js.tostring(ret)
end
return false, pair.name .. "\n" .. ret
end
exported[i] = ret
Expand Down

0 comments on commit 44c5da3

Please sign in to comment.