Posted 07 March 2014 - 11:43 PM
I had this program working a couple of nights ago and haven't changed anything but now it crashes when I try to click on the monitor.
Full Code - TankMon - steAmPI
It says "TankMon:132: Attempt to call nil" I've checked the syntax
Heres the code:
it references
function OnPushData(FluDetails, Mon)
local FluName = FluNamePicker(FluDetails["name"])
local Amount = FluDetails["amount"]
local Cap = FluDetails["capacity"]
local Percent = Percentage(Amount, Cap)
local RPercent = Round(Percent, 2)
Mon.clear()
Mon.setCursorPos(5,2)
Mon.setTextScale(2)
Mon.setTextColor(colors.white)
Mon.write(FluName)
Mon.setTextScale(1)
Mon.setCursorPos(3,3)
Mon.write("" .. Amount .. "/" .. Cap .. "")
Mon.setCursorPos(3,4)
Mon.write("" .. RPercent .. "%")
Mon.setCursorPos(13,10)
Mon.setBackgroundColor(colors.red)
Mon.setTextColor(colors.black)
Mon.write("<Back")
Mon.setBackgroundColor(colors.black)
while true do
local MonTouch ={os.pullEvent("monitor_touch")}
if MonTouch[4] == 13 and MonTouch[3] >= 10 and MonTouch[3] <= 14 then
return – end the function
end
end
end
Thanks I apologise in advance for the quality of my code i'm new to this :P/>
Full Code - TankMon - steAmPI
It says "TankMon:132: Attempt to call nil" I've checked the syntax
Heres the code:
local MonTouch = {os.pullEvent()}
if MonTouch[1] == "monitor_touch" then
if MonTouch[3] >= X1Pos and MonTouch[3] <= X1Pos + 10 and MonTouch[4] >= Y1Pos and MonTouch[4] <= Y1Pos + 1 then
steAmPI.OnPushData(tank1, Mon)
elseif MonTouch[3] >= X2Pos and MonTouch[3] <= X2Pos + 10 and MonTouch[4] >= Y1Pos and MonTouch[4] <= Y1Pos + 1 then
steAmPI.OnPushData(tank2, Mon)
elseif MonTouch[3] >= X1Pos and MonTouch[3] <= X1Pos + 10 and MonTouch[4] >= Y2Pos and MonTouch[4] <= Y2Pos + 1 then
steAmPI.OnPushData(tank3, Mon)
elseif MonTouch[3] >= X2Pos and MonTouch[3] <= X2Pos + 10 and MonTouch[4] >= Y2Pos and MonTouch[4] <= Y2Pos + 1 then
steAmPI.OnPushData(tank4, Mon)
else
end
else
--skip
end
it references
function OnPushData(FluDetails, Mon)
local FluName = FluNamePicker(FluDetails["name"])
local Amount = FluDetails["amount"]
local Cap = FluDetails["capacity"]
local Percent = Percentage(Amount, Cap)
local RPercent = Round(Percent, 2)
Mon.clear()
Mon.setCursorPos(5,2)
Mon.setTextScale(2)
Mon.setTextColor(colors.white)
Mon.write(FluName)
Mon.setTextScale(1)
Mon.setCursorPos(3,3)
Mon.write("" .. Amount .. "/" .. Cap .. "")
Mon.setCursorPos(3,4)
Mon.write("" .. RPercent .. "%")
Mon.setCursorPos(13,10)
Mon.setBackgroundColor(colors.red)
Mon.setTextColor(colors.black)
Mon.write("<Back")
Mon.setBackgroundColor(colors.black)
while true do
local MonTouch ={os.pullEvent("monitor_touch")}
if MonTouch[4] == 13 and MonTouch[3] >= 10 and MonTouch[3] <= 14 then
return – end the function
end
end
end
Thanks I apologise in advance for the quality of my code i'm new to this :P/>