mirror of
https://github.com/AR2000AR/openComputers_codes.git
synced 2025-09-09 07:01:14 +02:00
auto formatting
This commit is contained in:
@@ -17,7 +17,7 @@ function Button:draw()
|
|||||||
if isActive and self:shouldReset() and computer.uptime() - self._pressed > self:resetTime() then
|
if isActive and self:shouldReset() and computer.uptime() - self._pressed > self:resetTime() then
|
||||||
self:activate(false)
|
self:activate(false)
|
||||||
end
|
end
|
||||||
local newBG = isActive and (self:foregroundColor() or 0xffffff-self:backgroundColor()) or self:backgroundColor()
|
local newBG = isActive and (self:foregroundColor() or 0xffffff - self:backgroundColor()) or self:backgroundColor()
|
||||||
local oldBG = gpu.setBackground(newBG)
|
local oldBG = gpu.setBackground(newBG)
|
||||||
gpu.fill(self:absX(), self:absY(), self:width(), self:height(), " ")
|
gpu.fill(self:absX(), self:absY(), self:width(), self:height(), " ")
|
||||||
gpu.setBackground(oldBG)
|
gpu.setBackground(oldBG)
|
||||||
@@ -26,9 +26,9 @@ end
|
|||||||
function Button:activate(state)
|
function Button:activate(state)
|
||||||
checkArg(1, state, 'boolean', 'nil')
|
checkArg(1, state, 'boolean', 'nil')
|
||||||
local oldValue = self._active or false
|
local oldValue = self._active or false
|
||||||
if (state ~= nil) then
|
if (state ~= nil) then
|
||||||
self._active = state
|
self._active = state
|
||||||
if state then
|
if state then
|
||||||
self._pressed = computer.uptime()
|
self._pressed = computer.uptime()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -44,10 +44,10 @@ end
|
|||||||
|
|
||||||
function Button:shouldReset(should)
|
function Button:shouldReset(should)
|
||||||
checkArg(1, should, 'boolean', 'nil')
|
checkArg(1, should, 'boolean', 'nil')
|
||||||
local oldValue
|
local oldValue
|
||||||
if self._shouldReset == nil then oldValue = true else oldValue = self._shouldReset end
|
if self._shouldReset == nil then oldValue = true else oldValue = self._shouldReset end
|
||||||
if (should ~= nil) then self._shouldReset = should end
|
if (should ~= nil) then self._shouldReset = should end
|
||||||
return oldValue
|
return oldValue
|
||||||
end
|
end
|
||||||
|
|
||||||
return Button
|
return Button
|
||||||
|
Reference in New Issue
Block a user