lunarmodules / luacheck

A tool for linting and static analysis of Lua code.

Home Page:https://luacheck.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Question] E011: Expected `do` near `B10000000`

kylechui opened this issue · comments

Hi there, I've written a short snippet of Lua and I can't seem to understand why luacheck keeps throwing this error on the first line:

while byte >= 0B10000000 and byte < 0B11000000 do
    pos[2] = pos[2] - 1
    byte = string.byte(M.get_line(pos[1]):sub(pos[2], pos[2]))
end

image

Any help would be appreciated, and thanks for writing such a great piece of software!

I'm actually not 100% sure how to check the version of luarocks that I'm using since it's set up via GitHub actions, but it seems to be the most recent version(?). The workflow runs the following:

sudo apt install -y luarocks
sudo luarocks install luacheck

I realized that there's a marketplace thing for setting up CI; I'll try following the instructions in the README and re-open this if I'm unable to figure it out.

I was able to fix it by switching over to the workflow provided in the README. Sorry for the noise and thanks for maintaining this!

I'm glad you figured out your issue. With the info you give now I will suggest the underlying issue here is not the luacheck version but the lua version. The GitHub Action we provide is running on Lua 5.4 under the hood. The default Ubuntu environment you used is most likely running something quite a bit older.