8 kyu
Lua is easy: Lesson 1 - The basics
691KenKamau
Loading description...
Algorithms
Tutorials
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Lua translation
expected
andactual
in the right order resolving this issuemath.randomseed
The syntax highlighting in the description's code blocks is not working correctly, for clarity,
```Lua
in the description should be```lua
to enable itThe user solution and actual solution are swapped in the assertion.
Also the user solution is incorrectly assigned to the
expected
variable.Test framework documentation reference:
This comment has been hidden.
Yup, the expected and actual output in the assertion are swapped, re-raised as an issue.
The test is wrong.
Current: assert.are.same(solution.firstLua(10,20,30),"10 200 Codewars")
Must be: assert.are.same(solution.firstLua(10,20,30),"10 20 Codewars")
Bold statement. I see 279 passed solutions. What do you mean when you say you are more correct?
Oh, maybe I was wrong due to cache issues. If you can, delete my comment above.
This comment has been hidden.
You are missing a space in the returned answer.
This comment has been hidden.
You are missing
return kata
at the very end of your code. Copy your current code, hit reset and paste your code inside the function, it should work.Probably a bit late though...
What are the lines
kata = {}
andreturn kata
doing ?The first instruction creates the module and the second returns it. You can notice in the test's code that your module is imported by using the "require" keyword.
The Details tab lists Lesson 2 as "Numbers" and Lesson 3 as "Strings", when in fact Lesson 3 is "Numbers", and Lesson 4 is "Strings"
Thx. Will fix.
Fixed
The example in the description is wrong:
firstLua(1,2,3) --returns "1 6 Codewars"
This is inconsistent with the behaviour and the test cases, where the correct response is
"1 2 Codewars"
Thanks. Fixed description.
Sample tests: Please do not put empty string in the first argument of an
it
block. It eats everything from the stdout.Thanks Voile for pointing this out. I had initially fixed it for test cases but overlooked the Example tests.
It's all fixed now for all Lessons.
Resolved.
Thanks for Lua kata.
The description is incorrect
The tests expect
Also, make sure to give names to tests so the output is displayed, e.g.,
it("tests", function()
Write tests in the editor under the solution and hit "RUN SAMPLE TESTS".
Hi Kazk,
I have made the corrections, and applied them to all the Lessons especially the point on random tests and how to run sample code.
Resolved.