Non-Gmod related lua.

Not sure if this is the correct sub-forum to put this in but here goes.
[lua]
_DEBUG = 1

donator = {}
donators = {}

function donator:Add2Database(name, amt)
self.name = name
self.amt = amt

local d = {}
local DLVL

if amt <= 10 then
	DLVL = 1
elseif amt <= 20 then
	DLVL = 2
elseif amt <= 30 then
	DLVL = 3
elseif amt <= 50 then
	DLVL = 4
elseif amt >= 100 then
	DLVL = 5
end

if name == "" then
	print("MUST ENTER SOMETHING")
elseif amt <= 0 then
	print("invalid number! must be higher than zero(0)")
end

d[name] = {amt, DLVL}

table.insert(donators, d)

if _DEBUG then
	for k, v in pairs(donators) do
		print(k, v)
	end
            
            --this doesnt work.
	for k, v in pairs(d[name]) do
		print(k, v)
	end

end

d = donator
d:Add2Database(“dude”, 200)
[/lua]

2 questions I have here,

  1. How would I go about printing the d[name] table for debug purposes?
  2. How would I make a delete function to delete that table with the user’s name on it? I’m guessing something to have to do with table.remove but not sure how I would go about such a thing.
  1. print(d[name][1],d[name][2])

[lua]
for k,v in pairs(donators) do

if v[name] then

    table.remove(donators,k)
end

end
[/lua]