Jump to content

dbQuery doesnt pass my function to callback function


RizoN

Recommended Posts

Hello, I'm trying to do this:
 



function testFunction(sData, sSomething)

	local callbackFunction = function(result) outputChatBox(tostring(result)) end

	-- callback function is defined properly here

	Database:query(MyHandlerFunction, {callbackFunction, sData}, "SELECT * FROM my_database_table WHERE something=?", sSomething)

end



function MyHandlerFunction(query, func, data)
	-- func is nil here, but data is not nil
	func("hello") -- returns error, as it says that func is nil
end

testFunction("mydata", "123")


I'm using OOP
the query function doesn't seem to want to transport my callback function to my handler function, is it a query function limit or something? like it cant transport functions?

Edited by RizoN
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...