Skip to content

Commit

Permalink
Version 1.77
Browse files Browse the repository at this point in the history
Fix an issue where parsing was too lenient, leading to new-format import
strings sometimes being incorrectly parsed as invalid old-format import
strings.
  • Loading branch information
d0sboots committed Apr 2, 2024
1 parent 0225133 commit 7694fe6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
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.76 ─ Game: v0.45.0</span>
<span class="infotext">Editor: 1.77 ─ Game: v0.45.0</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
6 changes: 5 additions & 1 deletion main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,9 @@ function import(input)
local name = read"s1"

for i = 1, 3 do
for j = 1, read"i4" do
local sz = read"I4"
assert(sz >= 0, string.format("Bad import: Section %d had negative count %d", i, sz))
for j = 1, sz do
ins(parse())

if i == 3 then
Expand All @@ -579,6 +581,8 @@ function import(input)
ins""
end

assert(pos - 1 == #data, string.format("Bad import: Extra characters after parsing from %d-%d (%s)", pos - 1, #data, string.sub(data, pos)))

table.insert(ret, 1, "")

for var in pairs (variables) do
Expand Down
1 change: 0 additions & 1 deletion worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ async function importData(importCode) {
for (let {value, done} = await reader.read(); !done; {value, done} = await reader.read()) {
textStr += decoder.decode(value, {stream: true});
}
console.log("Text: " + textStr);
const parsedJson = JSON.parse(textStr);
const len = parsedJson?.scripts?.length ?? 0;
for (let i = 0; i < len; ++i) {
Expand Down

0 comments on commit 7694fe6

Please sign in to comment.