It exits the program(at line 78 and 97) and returns to the shell.I'm guessing it's a problem with the variables.
It does not error it just stops because of the if statements.
Edited by Glass Systems, 12 May 2014 - 03:10 PM.
Posted 11 May 2014 - 06:57 AM
Edited by Glass Systems, 12 May 2014 - 03:10 PM.
Posted 11 May 2014 - 10:15 AM
Posted 12 May 2014 - 04:53 AM
Posted 12 May 2014 - 06:32 AM
Posted 12 May 2014 - 01:50 PM
local select -- Make this local here instead so you can use it later
while true do
local event, button, X, Y = os.pullEvent("mouse_click")
local XY = X..","..Y
if XY=="1,8" then
select="add" -- You can't localize this here if you want to use it elsewhere, because then it will be local to this 'if' statement only
break
elseif XY=="1,9" then -- Use elseif instead
select="remove" -- Same here, if you localize it here you can only use it in this 'if' statement
break
end
end
while true do local foo = "bar" break end print( foo ) -- foo = nil since it was localized in the 'while' loop
local foo = true if foo then local bar = "Hello World!" end print( bar ) -- bar = nil since it was localized in the 'if' statement
Edited by TheOddByte, 12 May 2014 - 01:50 PM.
Posted 12 May 2014 - 03:09 PM
TheOddByte, on 12 May 2014 - 01:50 PM, said:
local select -- Make this local here instead so you can use it later
while true do
local event, button, X, Y = os.pullEvent("mouse_click")
local XY = X..","..Y
if XY=="1,8" then
select="add" -- You can't localize this here if you want to use it elsewhere, because then it will be local to this 'if' statement only
break
elseif XY=="1,9" then -- Use elseif instead
select="remove" -- Same here, if you localize it here you can only use it in this 'if' statement
break
end
end
while true do local foo = "bar" break end print( foo ) -- foo = nil since it was localized in the 'while' loop
local foo = true if foo then local bar = "Hello World!" end print( bar ) -- bar = nil since it was localized in the 'if' statement
0 members, 2 guests, 0 anonymous users