Bwc904
|
  |
| Joined: 16 Nov 2011 |
| Total Posts: 184 |
|
|
| 20 Sep 2016 04:33 PM |
Hey! I'm working on a script in which I do a getchildren() and then at that to another table, but the script just keeps skipping all my in pairs. Anyone know to fix it?
Here's a bit of my script.
function Tables() print "yolo" for i,v in pairs(InvC) do print"Doing" table.insert(InvT, v) print("First Table"..v) end end Tables()
-- it prints Yolo, but nothing else. |
|
|
| Report Abuse |
|
|
|
| 20 Sep 2016 04:37 PM |
| maybe InvC is an empty table? |
|
|
| Report Abuse |
|
|
Bwc904
|
  |
| Joined: 16 Nov 2011 |
| Total Posts: 184 |
|
|
| 20 Sep 2016 04:38 PM |
| No because it's not even printing "Doing" :/ |
|
|
| Report Abuse |
|
|
Bwc904
|
  |
| Joined: 16 Nov 2011 |
| Total Posts: 184 |
|
|
| 20 Sep 2016 04:38 PM |
| Well Yea, it MIGht be empty, would that make it not run? |
|
|
| Report Abuse |
|
|
igunaa
|
  |
| Joined: 15 Sep 2010 |
| Total Posts: 2588 |
|
|
| 20 Sep 2016 04:40 PM |
If it has nothing to run over, it won`t.
Said the wise. |
|
|
| Report Abuse |
|
|
|
| 20 Sep 2016 04:41 PM |
well yes because there is nothing to iterate :/
local iteration = 0 local iterfunc = function() return (iteration<10 and iteration) or nil end
for i in iterfunc do print(i) end |
|
|
| Report Abuse |
|
|
|
| 20 Sep 2016 04:42 PM |
oops i meant this
local iteration = 0 local iterfunc = function() iteration = iteration + 1 return (iteration<10 and iteration) or nil end
for i in iterfunc do print(i) end
--an intro into interating functions |
|
|
| Report Abuse |
|
|
| |
|
Bwc904
|
  |
| Joined: 16 Nov 2011 |
| Total Posts: 184 |
|
|
| 20 Sep 2016 04:46 PM |
| Thanks yall, It was doing to getchildren() before my other script even made the children so there was nothin in the table. ;) |
|
|
| Report Abuse |
|
|