Jump to content

empty value for key in table


LonelyRoad

Recommended Posts

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
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...