|
| 21 Apr 2015 01:24 PM |
local Table = {} Table.__index = table
function Table.new() local t = {} setmetatable(t, Table) return t end
myTable = Table.new() myTable:insert("value")
Found this on stack overflow, thought it was pretty cool. |
|
|
| Report Abuse |
|
|
MiniNob
|
  |
| Joined: 14 May 2013 |
| Total Posts: 822 |
|
| |
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 21 Apr 2015 01:29 PM |
That won't work on roblox.
I script -~ chimmihc |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 21 Apr 2015 01:30 PM |
Never mind, didn't see the Table = {} at the top.
I script -~ chimmihc |
|
|
| Report Abuse |
|
|
|
| 21 Apr 2015 01:36 PM |
Table = table
local table = {} table.__index = Table
function table.new() local t = {} setmetatable(t, table) return t end
myTable = table.new() myTable:insert("value")
Table.insert(myTable, "value2")
print(unpack(myTable)) |
|
|
| Report Abuse |
|
|
|
| 21 Apr 2015 01:43 PM |
| You won the life. My congratulations. |
|
|
| Report Abuse |
|
|
|
| 21 Apr 2015 01:44 PM |
| I know it's not anything crazy I just think it's cool. |
|
|
| Report Abuse |
|
|
Trioxide
|
  |
| Joined: 29 Mar 2011 |
| Total Posts: 32902 |
|
|
| 21 Apr 2015 01:48 PM |
| I used this method to create pseudoplayers so I can do player:save(player.leaderstats) |
|
|
| Report Abuse |
|
|
|
| 21 Apr 2015 02:09 PM |
| Lol I found that myself by experimenting a while back, and I asked the impact on performance it would take. Apparently in the long run it can be faster O_O |
|
|
| Report Abuse |
|
|
|
| 21 Apr 2015 02:10 PM |
Faster depending on implementation that is. I forget the exact details.
But I do know : is faster than . so y'know :P |
|
|
| Report Abuse |
|
|