darkshin
New old member
- Joined
- Dec 14, 2010
- Messages
- 231
- Reaction score
- 22
Hey Guys!!
I am in trouble while trying to store a database query. They function variables "guid" and "key" are beign rejected by the function saying:
If they are set to numbers:
"attempt to call local "guid" <a number value>"
If they are set to strings:
"attempt to call local "guid" <a string value>"
How can I make this work?
I am in trouble while trying to store a database query. They function variables "guid" and "key" are beign rejected by the function saying:
If they are set to numbers:
"attempt to call local "guid" <a number value>"
If they are set to strings:
"attempt to call local "guid" <a string value>"
How can I make this work?
Code:
function getStorageValueByGuid(guid, key)
---LOCALS
local stringGuid = tostring(guid) //whatever tonumber or tostring
local stringKey = tonumber(key) //whatever tonumber or tostring
---LOCALS
print(stringGuid, stringKey)
local resultId = db.storeQuery("SELECT `value` FROM `player_storage` WHERE `player_storage`.`player_id` = " .. guid " AND `player_storage`.`key` = " .. stringKey";")
if resultId ~= false or resultId ~= 0 then
local Finalvalue = result.getDataInt(resultId, "value")
print("value:", Finalvalue)
result.free(resultId)
return Finalvalue
else
print("result: fail")
return 0
end
end