I am currently running into issues. It seems to me like the callback just doesnt fire.
This is how my function works:
In this example, it works if it is instantly run after the database connected.
local queryDoesExist = db:prepare( [[
SELECT id FROM items
WHERE name = ?
function doesExist ( name, callback )
queryDoesExist:setString( 1, name )
function queryDoesExist:onSuccess ( rows )
return callback( #rows ~= 0 )
function queryDoesExist:onError ( err )
print( "Error: " .. err )
Calling it with lua_run or a proxy function doesn't work. It would print "0" and "2".