Okay, nevermind the original post: it's in the spoiler, but I figured it out.

This code in the spoiler isn't working, because if I click anywhere other than the first button created, the program errors.

Can anyone tell me why this is, and how to fix it?

I fixed it. Nevermind.
Thank you so much. :)/>
SpoilerThis. Is. Really. Pissing. Me. Off.

So, I've been writing code for about… say, 4 hours, and I'm trying to get a debug output of the table's contents so I can see what's going wrong.

To bad I can't get what I want.

The table should look like this:

--Taken from table.insert function--
table.insert(lft[c],{s=surface,x=x,y=y,w=w,h=h,text=text,f=f,icon=icon,background=background,foreground=foreground})

Surface is from CrazedProgrammer's Surface API, but it should only output the variable "surf", the surface I'm drawing them to.

Now, what's really confuzzled me is that they draw just fine using the SAME variables and table indexes, but I can't print any of them.

Any help?

EDIT: Here's the whole code if needed. I'm trying to serialize it on line 40.

os.loadAPI("LimeFyre/APIs/surface")

local ost = {}
local lft = {}

function round(num, idp)
local mult = 10^(idp or 0)
return math.floor(num * mult + 0.5) / mult
end

function centerPrint(surface,text,y,color)
local _,_,w,_ = surface:getBounds()
surface:drawText(round(w/2)-round(#text/2),y,text,nil,color)
end

function newOSTile(surface,text,x,y,f,background,foreground)
local w = x+#text+1
local h = y+2
surface:fillRect(x,y,w,h," ",background,foreground)
surface:drawText(x+1,y+1,text)
local c = #ost + 1
ost[c] = {}
table.insert(ost[c],{s=surface,x=x,y=y,w=w,h=h,f=f,text=text,background=background,foreground=foreground})

end

function newLFTile(surface,text,icon,x,y,f,background,foreground)
local w = x+#text+1
local h = y+4
surface:fillRect(x,y,w,h," ",background,foreground)
surface:drawText(x+1,h-1,text)
surface:drawText((round((w-x)/2)+x)-round(#icon/2),y+1,icon)
local c = #lft+1
lft[c] = {}
table.insert(lft[c],{s=surface,x=x,y=y,w=w,h=h,text=text,f=f,icon=icon,background=background,foreground=foreground})
end

function checkClick(b,x,y)
for k,l in pairs(ost) do
print(textutils.serialize(l[k]))
--[=[local v = l[k]
if x >= v.x and x <= v.w and y >= v.y and y <= v.h then
local background, foreground = colors.white,colors.black
if v.background == colors.white then
background,foreground = colors.black,colors.white
end
v.s:fillRect(v.x,v.y,v.w,v.h," ",background,foreground)
v.s:drawText(v.x+1,v.y+1,v.text)
v.s:render()
os.pullEventRaw("mouse_up")
v.s:fillRect(v.x,v.y,v.w,v.h," ",v.background,v.foreground)
v.s:drawText(v.x+1,v.y+1,v.text)
v.s:render()
return true,v.f
end--]=]
end
for k,l in pairs(lft) do
local v = l[k]
if x >= v.x and x <= v.w and y >= v.y and y <= v.h then
local background, foreground = colors.white,colors.black
if v.background == colors.white then
background,foreground = colors.black,colors.white
end
v.s:fillRect(v.x,v.y,v.w,v.h," ",background,foreground)
v.s:drawText(v.x+1,v.h-1,v.text)
v.s:drawText((round((v.w-v.x)/2)+v.x)-round(#v.icon/2),v.y+1,v.icon)
v.s:render()
os.pullEventRaw("mouse_up")
v.s:fillRect(v.x,v.y,v.w,v.h," ",v.background,v.foreground)
v.s:drawText(v.x+1,v.h-1,v.text)
v.s:drawText((round((v.w-v.x)/2)+v.x)-round(#v.icon/2),v.y+1,v.icon)
v.s:render()
return true,v.f
else

end
end
end

Tabs don't want to work. :\