Skip to content
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
6 changes: 5 additions & 1 deletion src/model/project/project.lua
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,11 @@ function ProjectService:run(name, env)
p_path, err = self.is_project(ProjectService.path, name)
end
if p_path then
local _, code = self.current:readfile(ProjectService.MAIN)
local ok, code = self.current:readfile(ProjectService.MAIN)
if not ok then return nil, code, p_path end
if type(code) ~= 'string' then
return nil, FS.messages.unreadable(ProjectService.MAIN), p_path
end
local content, c_err = codeload(code, env)
Comment thread
dsent marked this conversation as resolved.
return content, c_err, p_path
end
Expand Down
3 changes: 3 additions & 0 deletions src/util/lua.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ end
--- @return function? chunk
--- @return string? err
local codeload = function(code, env)
if type(code) ~= 'string' then
return nil, ('code must be a string (got %s)'):format(type(code))
end
local f, err = loadstring(code)

if not f then return nil, err end
Expand Down
Loading