Every minute I retrieve the following data from a webshop via a request.
{
['action'] = 'all',
['orders'] = { ['order'] = { [1] = { ['locationId'] = 1,
['id'] = 93,
['orderNumber'] = '3200'
}
}
},
['status'] = 'success'
}
From this table I need the ID number which I read with the code:
IdNummer = Table.orders.order[1].id;
If there is an order, this works
If no order is ready, I will receive the following table:
{
['action'] = 'all',
['orders'] = { ['order'] = {} },
['status'] = 'success'
}
Since "id" doesn't exist, I get the error: Attempt to index a nil value (field'?') How can I check if "id" exists without getting an error?