Posted 04 July 2014 - 10:47 PM
Okay so I have a table that can have lots and lots of entries, the thing is at some point it is going to be over the amount of the size of the screen, so how do I make either a button or a mouse_scroll to move it to the next page? the only thing I want to change is the data printed, things are printed before an after? so how could I do this? Here is my code? it uses a database, at the moment there isn't many entries, just need help in he future…
function database()
print("------------ All stored gate addresses ------------")
if not fs.exists("addresses") then
print("No database found!")
sleep(2)
main()
end
a = db.load("addresses")
if #a < 15 then
for k, v in ipairs(a) do
print(k..": "..v)
end
else
print("> Database to big..")
end
print("---------------- Press 'b' to exit ----------------")
print("------------ Press 'd' to dial address ------------")
print("----------- Press 'r' to remove address -----------")
while true do
local event, arg = os.pullEvent("char")
if arg == "b" then
main()
elseif arg == "d" then
print("> What address? (Use number)")
write("> ")
local toDial = tonumber(read())
gate.dial(a[toDial])
sleep(1)
database()
elseif arg == "r" then
print("> What address do you wish to remove? (Use number)")
write("> ")
local toRemove = tonumber(read())
db.removeString("addresses", a[toRemove])
database()
end
end
end