49 lines
1.4 KiB
Fennel
49 lines
1.4 KiB
Fennel
(local editor (require :editor))
|
|
(local game (require :game))
|
|
(local util (require :lib.util))
|
|
(local lume (require :lib.lume))
|
|
(local core (require :core))
|
|
(local command (require :core.command))
|
|
(local keymap (require :core.keymap))
|
|
(local translate (require :core.doc.translate))
|
|
|
|
(fn get-modname []
|
|
(-> core.active_view.doc.filename
|
|
(: :gsub "%.%a+$" "")
|
|
(: :gsub "/" ".")
|
|
(: :gsub "^data%." "")
|
|
(: :gsub "%.init$" "")))
|
|
|
|
(command.add "core.docview" {
|
|
"lume:hotswap" (fn []
|
|
(local modname (get-modname))
|
|
(core.log (.. "Hotswapping " modname))
|
|
(local (mod err) (util.hotswap modname))
|
|
(when (not= err nil) (print err) (error err)))
|
|
"fennel:unload-macro" (fn []
|
|
(let [modname (get-modname)]
|
|
(if (. fennel.macro-loaded modname)
|
|
(do (core.log (.. "Unloading macro module " modname))
|
|
(tset fennel.macro-loaded modname nil))
|
|
(core.log (.. modname " was not a loaded macro module")))))
|
|
})
|
|
(keymap.add {
|
|
"alt+r" "lume:hotswap"
|
|
"alt+u" "fennel:unload-macro"
|
|
})
|
|
|
|
(set love.load
|
|
(fn []
|
|
(local modes (require :editor.lovemode))
|
|
(let [f (io.open "game/state.fnl" :w)]
|
|
(f:write "{}")
|
|
(f:close))
|
|
|
|
(core.root_view:open_doc (core.open_doc "edtris.txt"))
|
|
(: (core.root_view:get_active_node) :split :right)
|
|
(core.root_view:open_doc (core.open_doc "game/state.fnl"))
|
|
|
|
(modes:cycle :game)))
|
|
|
|
{}
|