Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: potential typo/scope fixes #77

Merged
merged 5 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/actors/killer-tomato.fnl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@

(fn kt.on-death [s actor]
(when (< (love.math.random) 0.2)
(dungeon.spawn-actor s :tomato actor.pos
(dungeon.log (.. "The Killer Tomato became docile!")))))
(do
(dungeon.spawn-actor s :tomato actor.pos)
(dungeon.log "The Killer Tomato became docile!"))))

kt
2 changes: 1 addition & 1 deletion src/actors/tomato.fnl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(local tomato {})

(fn tomato.spawn [s pos]
{: kind
{:kind "tomato"
:name "tomato"
: pos
:color [1 0 0]
Expand Down
22 changes: 9 additions & 13 deletions src/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,20 @@
local fennel = require("lib.fennel")
local make_love_searcher = function(env)
return function(module_name)
local path = module_name:gsub("%.", "/") .. ".fnl"
if love.filesystem.getInfo(path) then
return function(...)
local code = love.filesystem.read(path)
return fennel.eval(code, {env=env}, ...)
end, path
end
path = module_name:gsub("%.", "/") .. "/init.fnl"
if love.filesystem.getInfo(path) then
return function(...)
local code = love.filesystem.read(path)
return fennel.eval(code, {env=env}, ...)
end, path
for _, filename in ipairs({".fnl", "/init.fnl"}) do
local path = module_name:gsub("%.", "/") .. filename
if love.filesystem.getInfo(path) then
return function(...)
local code = love.filesystem.read(path)
return fennel.eval(code, {env=env, filename=path}, ...)
end
end
end
end
end

table.insert(package.loaders, make_love_searcher(_G))
table.insert(fennel["macro-searchers"], make_love_searcher("_COMPILER"))
debug.traceback = fennel.traceback

require("game")