Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DockContainer={
- Position={
- x=1,
- y=1,
- z=1,
- },
- Content={
- },
- Draw=function(this,x,y)
- if x then this.Position.x=x end
- if y then this.Position.y=y end
- --print("Start of Draw procedure")
- for i,v in pairs(this.Content) do
- --print("loaded "..i..textutils.serialize(v))
- term.setCursorBlink(true)
- this.Content[i].position.x=this.Content[i].position.x+this.Position.x
- this.Content[i].position.y=this.Content[i].position.y+this.Position.y
- this.Content[i]:draw()
- --sleep(0.5)
- end
- end,
- --[[draw=function(this,x,y)
- this.draw(this,x,y)
- end,]]
- New=function(this,...)
- object = {}
- setmetatable(object,this)
- this.__index=this
- return object
- end,
- --[[new=function(this,...)
- return this.new(this,...)
- end,]]
- RegisterElement=function(this,el)
- local names=1
- --print("for")
- for reps=0,#this.Content do
- --print("repeats="..reps)
- for k,v in pairs(this.Content) do
- --print("k,v,reps="..k..","..textutils.serialize(v)..","..reps)
- if tostring(k)==el.name..reps+1 then --[[print("yes")]] names=names+1 end
- end
- end
- --[[if el.name and not this.Content[el.name] then
- this.Content[el.name]=el
- else]]
- this.Content[el.name..names]=el
- --end
- --table.insert(this.Content,el)
- end,
- Organise=function(this)
- local newIndex=1
- for k,v in ipairs(this.Content) do
- end
- end,
- }
- dofile(shell.resolve(".").."/label.lua")
- term.setBackgroundColor(0)
- shell.run("clear")
- x=DockContainer:New()
- x.Position={x=10,y=10}
- lab1=label:new()
- lab2=label:new()
- --print(textutils.serialize(x.Content))
- x:RegisterElement(lab1)
- --print(textutils.serialize(x.Content))
- x:RegisterElement(lab2)
- x.Content["label1"].position.y=4
- x.Content["label2"].position.y=1
- x:Draw()
- --print(textutils.serialize(x.Content["label1"]))
Advertisement
Add Comment
Please, Sign In to add comment