Hi friends,
I cant’t understand this error, maybe because I’m new to lua.
Check this code:
[lua]local data = {}
local json = require(“json”)
local URL = “https://example.com/json”
local function jsonGet(event)
if ( event.isError ) then
print ( “Network error - download failed” )
else
data = json.decode(event.response)
print("TITLE: " … data[1].title)
end
end
network.request( URL, “GET”, jsonGet )
print("TITLE: " … data[1].title)[/lua]
I’m getting this error on the second PRINT command. The first one is printing the value.
[lua]attempt to index field ‘?’ (a nil value)[/lua]
Thanks in advance [import]uid: 189638 topic_id: 33680 reply_id: 333680[/import]