From d2fc4519982225ccd018a3a7767d76ee01736a5d Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 8 Sep 2024 23:24:10 -0500 Subject: [PATCH] Fix lua lint errors, move mac installation of luarocks --- .github/workflows/lua.yml | 4 ++++ lua/src/p0001.lua | 6 +++--- lua/src/p0002.lua | 4 ++-- lua/src/p0017.lua | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/lua.yml b/.github/workflows/lua.yml index 67f396df..1b2eddd2 100644 --- a/.github/workflows/lua.yml +++ b/.github/workflows/lua.yml @@ -50,7 +50,11 @@ jobs: with: withLuaPath: "lua" + - run: sudo luarocks install luacov + if: ${{ !contains(matrix.os, 'windows') }} + - run: luarocks install luacov + if: ${{ contains(matrix.os, 'windows') }} - run: make lu_test COV=true diff --git a/lua/src/p0001.lua b/lua/src/p0001.lua index ed502cc9..b3b56a96 100644 --- a/lua/src/p0001.lua +++ b/lua/src/p0001.lua @@ -19,17 +19,17 @@ return { local answer = 0 for i = 3,999,3 - do + do answer = answer + i end for i = 5,999,5 - do + do answer = answer + i end for i = 15,999,15 - do + do answer = answer - i end diff --git a/lua/src/p0002.lua b/lua/src/p0002.lua index 2824902f..f6926e4f 100644 --- a/lua/src/p0002.lua +++ b/lua/src/p0002.lua @@ -21,8 +21,8 @@ return { while b < 4000000 do answer = answer + b - - for j = 1,3,1 + + for _ = 1,3,1 do a, b = b, a + b end diff --git a/lua/src/p0017.lua b/lua/src/p0017.lua index 998e8d60..d3eac039 100644 --- a/lua/src/p0017.lua +++ b/lua/src/p0017.lua @@ -83,7 +83,7 @@ return { local answer = 0 for x = 1,1000,1 - do + do answer = answer + to_string_len(x) end