'=' expected near 'if' problem
Posted: Wed Sep 28, 2016 11:34 am
So, I tried to make a switch palace, and found this script from the official PGE wiki, so it probably should work, but it doesn't. I'm just getting this error: '=' expected near 'if'. Is it a bug? I can't find any errors.
The script

The script
Code: Select all
local myGlobalData = Data(Data.DATA_WORLD, "switchPalace")
if myGlobalData == nil then
myGlobalData:set("exampleGlobalSwitch", tostring(1))
myGlobalData:save()
end
function onEvent(eventname)
if eventname == "globalBarrierKill" then
myGlobalData:set("exampleGlobalSwitch", tostring(0))
myGlobalData:save()
end
end
local ranInitialCheck = false;
local barrierData = myGlobalData:get("exampleGlobalSwitch");
function onLoop()
if ranInitialCheck == false then
if barrierData = tostring(0) then
triggerEvent("globalBarrierKill")
end
ranInitialCheck = true;
end
end