Jump to content

attempt to compare number with table


thund3rbird23

Recommended Posts

I used this code about 2 months ago and works fine, now I get error: attempt to compare number with table (on line 7) why?
 

function loadAllGate()
	gates = {}
	local queryHandler = dbQuery(connection, "SELECT * FROM gates")
	local result, num, errorMsg = dbPoll(queryHandler, 10)
	if result > 0 then
		for key, row in ipairs(result) do
			local gateId = tonumber(row["id"])
			gates[key] = {}

			gates[key]["sqlId"] = gateId
			gates[key]["modelId"] = tonumber(row["modelId"])

			gates[key]["lockState"] = true

			gates[key]["defaultState"] = fromJSON(row["defaultState"])
			gates[key]["changeState"] = fromJSON(row["changeState"])
			gates[key]["createRotation"] = fromJSON(row["createRotation"])
			gates[key]["IndDim"] = fromJSON(row["IndDim"])
 
			gates[key]["gate"] = createObject(gates[key]["modelId"], gates[key]["defaultState"][1], gates[key]["defaultState"][2], gates[key]["defaultState"][3], gates[key]["defaultState"][4], gates[key]["defaultState"][5], gates[key]["defaultState"][6])
			setElementRotation(gates[key]["gate"], gates[key]["createRotation"][1], gates[key]["createRotation"][2], gates[key]["createRotation"][3])
			setElementInterior(gates[key]["gate"], gates[key]["IndDim"][1])
			setElementDimension(gates[key]["gate"], gates[key]["IndDim"][2])
		end
	end
	outputDebugString(#gates .. " gate(s) loaded")
end
addEventHandler("onResourceStart", resourceRoot, loadAllGate)

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...