Downloading table information - how to?

Imagine these lines of code;

local currentName local currentJob local currentStatus local table = { { name = "Mark", job = "Mayor", status = "Alive" } { name = "Pete", job = "Doctor", status = "Alive" } { name = "John", job = "Innkeeper", status = "Alive" } { name = "Luke", job = "Unemployed", status = "Dead" } }

Let’s say I need to gain some info out of the table, for example, in this case, from the doctor. How do I instruct Corona to get the information of the doctor, so that I get the following results;

local currentName = "Pete" local currentJob = "Doctor" local currentStatus = "Alive"

I have searched several websites, but I couldn’t find any of these…  :unsure:

I changed the name of table to tbl, “table” is a reserved name that you don’t want to overwrite or you lose access to lua’s table functions.

local currentName local currentJob local currentStatus local tbl = { { name = "Mark", job = "Mayor", status = "Alive" } { name = "Pete", job = "Doctor", status = "Alive" } { name = "John", job = "Innkeeper", status = "Alive" } { name = "Luke", job = "Unemployed", status = "Dead" } } for a = 1, #tbl, 1 do -- loop through all the records in tbl local r = tbl[a] -- get this record if r.job == "Doctor" then -- check if this is the record we want currentName = r.name currentStatus = r.status currentJob = r.job -- if so, store the results end end

I changed the name of table to tbl, “table” is a reserved name that you don’t want to overwrite or you lose access to lua’s table functions.

local currentName local currentJob local currentStatus local tbl = { { name = "Mark", job = "Mayor", status = "Alive" } { name = "Pete", job = "Doctor", status = "Alive" } { name = "John", job = "Innkeeper", status = "Alive" } { name = "Luke", job = "Unemployed", status = "Dead" } } for a = 1, #tbl, 1 do -- loop through all the records in tbl local r = tbl[a] -- get this record if r.job == "Doctor" then -- check if this is the record we want currentName = r.name currentStatus = r.status currentJob = r.job -- if so, store the results end end