|
| 27 Sep 2016 12:32 PM |
Lets say I have a table {'a','b',nil,'d'}
How do I pick out the nil in the table but keep the same order? |
|
|
| Report Abuse |
|
|
|
| 27 Sep 2016 12:46 PM |
nil can't exist in a table
https://www.roblox.com/library/322704057/Hillary-Clinton |
|
|
| Report Abuse |
|
|
JoshRBX
|
  |
| Joined: 19 May 2012 |
| Total Posts: 8778 |
|
|
| 27 Sep 2016 01:01 PM |
If it's nil, it doesn't exist.
|
|
|
| Report Abuse |
|
|
|
| 27 Sep 2016 01:47 PM |
It can because when I unpack the table it says this:
English nil Sports Science Geography
So my question again, how do I get rid of of the nil inside an ARRAY then |
|
|
| Report Abuse |
|
|
qqtt991
|
  |
| Joined: 14 Dec 2007 |
| Total Posts: 1387 |
|
|
| 27 Sep 2016 01:51 PM |
You.. shouldn't be letting nils get into your tables at all?
|
|
|
| Report Abuse |
|
|
iIikeyou
|
  |
| Joined: 07 Mar 2012 |
| Total Posts: 1659 |
|
|
| 27 Sep 2016 02:13 PM |
that is very strange, apparently you can get a nil value in a table if you set it up with nil being between actual values
heres a protip, dont set up your tables with nil in them |
|
|
| Report Abuse |
|
|
|
| 27 Sep 2016 02:14 PM |
| This generates the nil, I just cannot find out why. function #################### ##### is a number from 1-4, function called i = 1,4 do local New = {} local R = Pos for i,v in pairs (Table) do if R + 1 > #Table then R = 1 elseif R + 1 <= #Table then R = R + 1 end table.insert(New,R,v) end local Fixed = {} -- trying to fix the nil part here, did not work for local Deduct = 0 for i,v in pairs (New) do if v ~= nil then table.insert(Fixed,i - Deduct,v) else Deduct = Deduct + 1 end end return Fixed end |
|
|
| Report Abuse |
|
|