• returning table through sql function
    2 replies, posted
so im having some troubles... [CODE] 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"]) end returnt:start() end [/CODE] when i call this in a print function for example it returns nothing at all :P 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.
[QUOTE=sannys;51565566]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.[/QUOTE] well... that isnt nice :( guess thats my only way forward [editline]21st December 2016[/editline] thanks anyway bud
Sorry, you need to Log In to post a reply to this thread.