SuperiorServers / gm_tmysql4

MySQL connection module for Garry's Mod servers - SUP has picked up and maintained the module since it was abandoned years ago - Original author: @bkacjios
32 stars 7 forks source link

callbacks not running #21

Open Nocturnal337 opened 3 months ago

Nocturnal337 commented 3 months ago

win11

function lts.chars.getMoney(id, currencyIndex, callback)
    print("getting..")
    local sql = string.format("SELECT `currency_%d` FROM `characters` WHERE `id` = %d;", currencyIndex, id)
    print(sql)
    db:Query(sql, function(result)
        if result and #result > 0 then
            callback(result[1][string.format("currency_%d", currencyIndex)])
        else
            callback(nil)
        end
    end)
end

lts.chars.getMoney(1, 1, function(currency)
    print("Currency 1 Amount: ", currency)
end)

Callback refuses to run, i could be retarded tho.

Nocturnal337 commented 3 months ago

I should probably note that entry queries work just fine, it's made tables and data and connects perfectly, I've tested the SQL that the script above makes inside of phpmyadmin, the SQL is fine with no errors. Ive also tested it with the code example on the readme - though replacing it with the SQL script that works in phpmyadmin, the callback function just doesnt seem to run whatsoever