LonelyRoad Posted January 5, 2015 Share Posted January 5, 2015 If the value of a key in a table is empty (in context, its a table being returned from a MySQL query) should it be a userdata value? Basically what I have is this: if (characterData["faction_perks"]) then local factionPerks = fromJSON(characterData["faction_perks"]) else local factionPerks = { } It never triggers the else, instead returns characterData["faction_perks"] as userdata: 01E10138, and hence returns the following error: Bad argument @ 'fromJSON' [Expected string at argument 1] I have also just tried using this: local factionPerks = fromJSON(characterData["faction_perks"]) or { } The default value of faction_perks in the MySQL table is NULL. Link to comment
LonelyRoad Posted January 5, 2015 Author Share Posted January 5, 2015 It appears it is poor handling of NULL on part of the mysql module (not the native mysql functions). I added a type() check for string, and it works fine. Mods, Please lock/delete. Link to comment
Recommended Posts