so iam try make this:
local t = {5,nil,2,nil,3} change to this t = {5,2,3}
i try make this but no work
function orderTable(t)
local nt = {}
local c = 0
for k,v in ipairs(t) do
if(v ~= nil)then
c = c +1
print(c)
table.insert(nt,v)
end
end
return nt
end
addCommandHandler("ta",
function()
local t = {5,nil,2,nil,3}
j = orderTable(t)
for k,v in ipairs(j)do
print(tostring(v))
end
end)
any help?