Help with mysqloo and callback

Hi,
I’ve got a problem with Mysqloo.

I’ve this code:
[LUA]
local q = MySQLDB:query(“SELECT first_name, last_name, wallet, cars, items FROM rp_players WHERE id=’” … Player:SteamID() … “’”)
function q:onSuccess(data)
PrintTable(data)
end
q.onError = function( err, sql ) print( “Query errored!” ) end
q:start()
[/LUA]

I want to adapt this code to use it more simply :
[LUA]
local data = MYFUNCTION.query(“SELECT first_name, last_name, wallet, cars, items FROM rp_players WHERE id=’” … Player:SteamID() … “’”)
PrintTable(data)
[/LUA]

so, I coded a new function :
[LUA]
function MYFUNCTION.Query(sql)
local q = MySQLDB:query( sql )
function q:onSuccess( data )
return data
end

function q:onError( err )
	print( "Query Errored, error:", err, " sql: ", sql )
end

end
[/LUA]

This method doesn’t work, it returns a nil value.
Do an alternative exists ?

Sorry for my bad english, I’m french

What returns a nil value? It’d be best if you could give the full error.

There is no error :suicide:

You cannot return from a callback to the initiator of the query.

Is there another way ?

You could use wait() but I highly discourage that as it “hangs” the server until the query was ran(PHP style).

Just keep to the callback style.