Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --progressBar Element for ACOS GUI Framework
- --USE WITHOUT MY (viluon's) EXPLICIT PERMISSION IS AGAINST THE COPYRIGHT!!!!!!!!!!!!!
- progressBar={
- localValue=0,
- width=0,
- backgroundColor=colors.white,
- foregroundColor=colors.green,
- value=function(this,val)
- if not this then error("'this' equals nil",2) end
- if val then
- this.localValue=val
- return this.localValue
- else
- return this.localValue
- end
- end,
- print=function(this,x,y)
- if not this then error("'this' equals nil",2) end
- local xOrg,yOrg=term.getCursorPos()
- term.setCursorPos(x,y)
- term.setBackgroundColor(this.backgroundColor)
- write(string.rep(" ",this.width))
- term.setCursorPos(x,y)
- term.setBackgroundColor(this.foregroundColor)
- write(string.rep(" ",(this.width/100)*this.localValue))
- term.setCursorPos(xOrg,yOrg)
- end,
- new=function(this,object)
- object = object or {}
- setmetatable(object, this)
- this.__index = this
- return object
- end,
- }
- x=progressBar:new({width=10,localValue=70})
- print(x:value())
- term.clear()
- x:print(10,11)
Advertisement
Add Comment
Please, Sign In to add comment