Chat about current Lua tools and IDEs

User avatar
By hoksibish
#77218 So im pretty new to the MCU world. I am trying to upload some lus files and I am lost as to whats going on. I am on a Mac and trying to use luatool that i cloned from github. I have Python 2.7.10 installed as well. here is the command and error:

python luatool/ --port /dev/cu.wchusbserial1460 --src ~/Downloads/konnected-security-master/src/actuators.lua --dest actuators.lua --restart

->"actuators.lua", "w")
->"actuators.lua", "w+")
->file.writeline([==[local actuators = {}]==])
->file.writeline([==[return actuators]==])
->file.close()Traceback (most recent call last):
File "luatool/", line 330, in <module>
File "luatool/", line 122, in writeln
File "luatool/", line 93, in performcheck
if char == chr(62) and expected[i] == char:
IndexError: string index out of range

no idea were to start. tried google but not sure what the actual issue is that i need to sort. I know it says line 93 but not sure what should even be there. any direction would be awesome! thanks
User avatar
By markaldo
#84536 In Python, a string is a single-dimensional array of characters. The string index out of range means that the index you are trying to access does not exist. In a string, that means you're trying to get a character from the string at a given point. If that given point does not exist , then you will be trying to get a character that is not inside of the string. Indexes in Python programming start at 0. This means that the maximum index for any string will always be length-1.
There are several ways to account for this. Knowing the length of your string (using len() function)could certainly help you to avoid going over the index.