Skip to content

Commit

Permalink
fix bugs with text, bgimage, and saving
Browse files Browse the repository at this point in the history
text no longer fails for empty strings
bgimage now checks if the path exists
saving now saves the last instruction
  • Loading branch information
ajusa committed Jan 3, 2021
1 parent 1e5bb53 commit 70e0914
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/images.moon
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on "save", =>
@images = _.map(images, => {path: @path, x: @x, y: @y})

on "restore", =>
dispatch "bgload", @background
if @background.path != nil then dispatch "bgload", @background
for image in *@images do dispatch "setimg", image

first_bg = true
Expand Down
2 changes: 1 addition & 1 deletion src/script.moon
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ load = (base_dir, fs, data = file: "main.scr") ->
s = {:base_dir, :fs, locals: {}, globals: {}}
s = _.extend(s, read_file(s, data.file))
_.extend(s, data)
save = (s) -> {file: s.file, locals: s.locals, globals: s.globals, n: s.n-2}
save = (s) -> {file: s.file, locals: s.locals, globals: s.globals, n: s.n-1}
mem = (s, key) -> s.locals if s.locals[key] ~= nil else s.globals
mem_type = (s, type) -> s.locals if type == "setvar" else s.globals
choose = (s, val) -> s.locals["selected"] = val
Expand Down
1 change: 1 addition & 0 deletions src/text.moon
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on "choose", => focused = false
on "text", =>
focused = true
no_input = false
if @text == '' then return
if @text\sub(1, 1) == "@"
@text = @text\sub(2, -1)
no_input = true
Expand Down

0 comments on commit 70e0914

Please sign in to comment.