returning table through sql function

so im having some troubles…

local ply = FindMetaTable("Player")
function ply:ReturnTable()
  local returnt = db:query("SELECT * FROM `gmrp` WHERE `steamid`='" .. self:SteamID() .. "'")
  function returnt:onSuccess(data)
    return util.JSONToTable(data[1]["tab"])

when i call this in a print function for example it returns nothing at all :stuck_out_tongue: i was wondering if there is a reason why?

[editline]21st December 2016[/editline]

i have a feeling it is because its inside the onsuccess function but i have no clue how to make it return from the main ReturnTable function

You can’t. Not unless you want your server to lock up until the query finishes. Your solution is to just do everything in the success callback.

well… that isnt nice :frowning: guess thats my only way forward

[editline]21st December 2016[/editline]

thanks anyway bud