simplify script loading

This commit is contained in:
filifa 2024-09-02 23:26:10 -05:00
parent 86ef3a0e82
commit 75ba1e8134
1 changed files with 2 additions and 12 deletions

View File

@ -18,7 +18,6 @@ package cmd
import ( import (
"encoding/json" "encoding/json"
"io"
"log" "log"
"os" "os"
@ -41,17 +40,8 @@ func (s *script) load(path string) error {
} }
defer f.Close() defer f.Close()
data, err := io.ReadAll(f) err = json.NewDecoder(f).Decode(s)
if err != nil {
return err return err
}
err = json.Unmarshal(data, s)
if err != nil {
return err
}
return nil
} }
func handleWindowEvent(event *sdl.WindowEvent, m *milkDropWindow) { func handleWindowEvent(event *sdl.WindowEvent, m *milkDropWindow) {