How do you return all values of an array in Lua?
<p>Sorry if this is a dumb question, I'm a fairly inexperienced programmer.</p>

<p>I'm trying to return all values within an array using Lua. I can return individual elements by calling their index (ex. read_data[2]) but since the number of elements in the array is variable, I cannot simply type this out. My code:</p>

<pre><code>function readformatEvent()

local read_data = {}
local duplicate
local unique_data = {}

for i=1,16 do
    read_data[i] = readResult(i):readData()
end

for i=1,16 do
    duplicate = 0

    for j=(i+1),15 do
        if read_data[i] == read_data[j] then
            duplicate = 1
        end
    end

    if duplicate == 0 then
        unique_data[i] = read_data[i]
    end
end

return unique_data

end
</code></pre>

<p>unique_data is an array consisting of unique values from the array read_data. read_data can consist of 1 to 16 elements. Being able to see the full array would help me continue to craft the code as a troubleshooting technique.</p>

<p>Thank you,</p>