'Script is returning a syntax error on blank line
This code is returning a "Syntax error: Line:26" the line where the error it mentioned is the blank line under "Don't Modify These Settings" I just tried to delete the line, but whatever the number of lines I delete the error keep going, can someone please help? thanks in advance.----------------------------------------------------------------------------------------------------------
here's the code:
2--[[PUBG LEANSPAM SCRIPT 1.0]]--
--[[MASTER SCRIPT ENABLE/DISABLE SETTING]]--
--------------------------------------------------------------------------------------------------------------
local st_k="scrolllock" --TURN ON/OFF SCRIPT.
--[[NO RECOIL SETTINGS]]--
--------------------------------------------------------------------------------------------------------------
local n_r=5 --HOW MANY PIXELS THE MOUSE IS MOVED DOWN DEFAULT: 5
local nr_s=40 --INTERVAL BETWEEN MOUSE MOVEMENTS DEFAULT: 40
local nr_p=0 --DELAY BEFORE STARTING MOUSE MOVEMENTS EACH TIME DEFAULT: 0
--[[LEAN-SPAM SETTINGS]]--
--------------------------------------------------------------------------------------------------------------
local lt_k="capslock" --KEY TO TURN ON/OFF LEANSPAM WHILE LEFT CLICKING
local ll_k="Q" --LEFT PEEK KEY SETTING DEFAULT: "Q"
local rl_k="E" --RIGHT PEEK KEY SETTING DEFAULT "E"
local m_l=3 --FINE TUNE SETTING FOR LEAN TIME - LOWER NUMBER = FASTER LEANING (MUST BE ODD NUMBER TO WORK PROPERLY) DEFAULT: 3
--[[DON'T MODIFY THESE SETTINGS]]--
--------------------------------------------------------------------------------------------------------------
local l_s=nr_s*(m_l//2)
local l_st=1
local o_r
local ls_s
local l_k
--[[FUNCTIONS]]--
--------------------------------------------------------------------------------------------------------------
function lean_spam()
if l_k == ll_k then
l_k=rl_k
else
l_k=ll_k
end
PressKey(l_k)
Sleep(l_s)
ReleaseKey(l_k)
no_recoil=l_s//m_l
end
function leandir()
if ls_s then
if (l_k == ll_k) then
return (l_st)
else
return -(l_st)
end
else
return 0
end
end
function norecoil()
Sleep(nr_p)
repeat
o_r=n_r
if ls_s then
if (l_st > m_l) then
lean_spam()
l_st=0
else
l_st=l_st+1
end
end
n_r=o_r
MoveMouseRelative(leandir(),n_r)
Sleep(nr_s)
until not IsMouseButtonPressed(1) or not IsMouseButtonPressed(3)
end
--[[MAIN ONEVENT FOR SCRIPT FUNCTIONALITY]]--
--------------------------------------------------------------------------------------------------------------
function OnEvent(event, arg)
if not IsKeyLockOn(st_k) then
EnablePrimaryMouseButtonEvents(false)
else
EnablePrimaryMouseButtonEvents(true)
end
if IsKeyLockOn(lt_k) then
ls_s=true
else
ls_s=false
end
if (IsMouseButtonPressed(1) and IsMouseButtonPressed(3) and IsKeyLockOn(st_k)) then
norecoil()
end
end
Solution 1:[1]
The LGS editor has a bug: it points to the line above error instead of the error line. The actual syntax error is at line 27.
This code is written for Logitech GHub, it embeds Lua 5.4.
You are using LGS, it embeds Lua 5.1.
There is no // operator in Lua 5.1, you have to replace all // with math.floor().
For example, replace m_l//2 with math.floor(m_l/2)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Egor Skriptunoff |

