diff --git a/modules/lang/lua/autoload.el b/modules/lang/lua/autoload.el index 2fc165a41..d244c2000 100644 --- a/modules/lang/lua/autoload.el +++ b/modules/lang/lua/autoload.el @@ -11,9 +11,10 @@ (defun +lua/run-love-game () "Run the current project with Love2D." (interactive) - (async-shell-command - (format "%s %s" - (or (executable-find "love") - (if IS-MAC "open -a love.app")) - (shell-quote-argument (doom-project-root))))) + (when-let* ((root (locate-dominating-file buffer-file-name "main.lua"))) + (async-shell-command + (format "%s %s" + (or (executable-find "love") + (if IS-MAC "open -a love.app")) + (shell-quote-argument (file-name-directory root))))))