Hey! We’ve solved Bob in Lua. The tests pass locally, but “an error occurred” when trying to test the same code online. We’ve reduced the program to bare skeleton, and the error changes when there’s no function hey
at all. At that point, the tests report an attempt to call a nil value.
How to have this issue fixed for us to proceed?
If you share your exact code and the exact test output, we may be able to spot and bugs in your code and/or reproduce and issues with the website. Please use codeblocks. Please do not use screenshots/images.
Thanks for looking into the issue! We’ve tried to submit the following code a couple of times:
local bob = {}
---Get Bob's answer
---@param say string
---@return string
function bob.hey(say)
say = say:gsub(' ', '')
local is_question = say:sub(#say) == "?"
local is_yell = not say:find('[a-z]')
if say == "" then
return "Fine, be that way."
elseif is_yell then
return is_question and "Calm down, I know what I'm doing!" or "Whoa, chill out!"
elseif is_question then
return "Sure"
else
return "Whatever"
end
end
return bob
But it turns out that anything fails with bob.hey
in it. Even this one:
local bob = {}
function bob.hey(say)
return "Whatever"
end
return bob
The error message is:
An error occurred while running your tests. This might mean that there was an issue in our infrastructure, or it might mean that you have something in your code that's causing our systems to break.
Please check your code, and if nothing seems to be wrong, try running the tests again.
Thanks for the heads up. The test runner was recently modified to fix an issue and it probably caused this one. I’ll investigate today.
1 Like
Thanks, much appreciated!