The code is returning an " Attempt to index upvalue ‘decodedData’. Not sure why, I research and still couldn’t find the problem. This is the code that I have:
myNewData = event.response
decodedData = (json.decode(myNewData))
The code is returning an " Attempt to index upvalue ‘decodedData’. Not sure why, I research and still couldn’t find the problem. This is the code that I have:
myNewData = event.response
decodedData = (json.decode(myNewData))
You might be trying to get the index that is not available in array.
Try this :
[lua]
myNewData = event.response
decodedData = json.decode(myNewData)
local printTable = function(table, stringPrefix)
if not stringPrefix then
stringPrefix = "### "
end
if type(table) == “table” then
for key, value in pairs(table) do
if type(value) == “table” then
print(stringPrefix … tostring(key))
print(stringPrefix … “{”)
printTable(value, stringPrefix … " ")
print(stringPrefix … “}”)
else
print(stringPrefix … tostring(key) … ": " … tostring(value))
end
end
end
end
printTable(decodedData)
[/lua]
Now you will get to know what key-value is coming in response.
Thanks
Assif** | BIZZCODE STUDIOS**
You might be trying to get the index that is not available in array.
Try this :
[lua]
myNewData = event.response
decodedData = json.decode(myNewData)
local printTable = function(table, stringPrefix)
if not stringPrefix then
stringPrefix = "### "
end
if type(table) == “table” then
for key, value in pairs(table) do
if type(value) == “table” then
print(stringPrefix … tostring(key))
print(stringPrefix … “{”)
printTable(value, stringPrefix … " ")
print(stringPrefix … “}”)
else
print(stringPrefix … tostring(key) … ": " … tostring(value))
end
end
end
end
printTable(decodedData)
[/lua]
Now you will get to know what key-value is coming in response.
Thanks
Assif** | BIZZCODE STUDIOS**