| |
|
|
| 25 Dec 2015 01:35 PM |
| That's how it works in regular Lua, I'm not sure if it works in RBXLua but it should. |
|
|
| Report Abuse |
|
|
|
| 25 Dec 2015 01:36 PM |
table.getn which will return the length of the table, but that is deprecated now to replace the we use the #(Number operator) instead.
When people do this :
local Table = {"getSoltuion3",101,"gg"}
for i = 1, #Table do print(Table[i]) wait() end
They do 1, #Table do because 1 is the first position in the Data Structure where #Table is how many key there are in the Table.
print(Table[i]) is printing all the values in the table, because behind the scenes it is actually doing this:
for i = 1, 3 do print(Table[i]) wait() end
SInce they are only 3 Keys in our table, you can do for i = 1, 3 do also. |
|
|
| Report Abuse |
|
|
|
| 25 Dec 2015 01:37 PM |
Yes but it can also work with tables
local tab = {4,1,346,43} print(#tab)
>4
#code Instance.new("BodyThrust",SenseiWarrior).position = CFrame.new(SenseiWarrior,YourGirlsDMs) |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 25 Dec 2015 01:38 PM |
# is the length operator.
It can be used on string and tables by default but can also work with values with the len metamethod set(But tables in Lua 5.1.x are not effected by the len metamethod).
For getting the length of a string it is much faster than string.len. |
|
|
| Report Abuse |
|
|
| |
|
| |
|