|
| 13 Nov 2012 11:32 PM |
The Instance, Vector3, Vector2, UDim, UDim2, BrickColor, etc tables, in the environment, are read-only. This means you can't edit them, even if you try using rawset.
Really? Nope. I just found out that you can add numerical indices in them by using the table.insert function. And you can probably remove numerical indices from them too using table.remove (though I didn't test that).
Clearly, this is a bug, and it's not supposed to happen. And it's probably not too hard to fix either... then, again, adding read-only tables to the API wasn't exactly a such good idea. |
|
|
| Report Abuse |
|
|
Seranok
|
  |
| Joined: 12 Dec 2009 |
| Total Posts: 11083 |
|
|
| 13 Nov 2012 11:55 PM |
| There goes my secret Catalog Heaven update system... >_< |
|
|
| Report Abuse |
|
|
|
| 14 Nov 2012 12:00 AM |
| How can that even be used to update a game? |
|
|
| Report Abuse |
|
|
|
| 14 Nov 2012 12:02 AM |
"There goes my secret Catalog Heaven update system... >_<"
You're kidding, right? |
|
|
| Report Abuse |
|
|
SN0X
|
  |
| Joined: 24 Oct 2011 |
| Total Posts: 7277 |
|
| |
|
Quenty
|
  |
| Joined: 03 Sep 2009 |
| Total Posts: 9316 |
|
| |
|
NXTBoy
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 4533 |
|
|
| 14 Nov 2012 01:56 AM |
| Does that mean `table.insert` doesn't fire the `__newindex` metamethod? |
|
|
| Report Abuse |
|
|
|
| 14 Nov 2012 02:02 AM |
@NXTBoy
It doesn't. Neither does rawset, but the case of rawset is prevented by read-only tables. However, the case of table.insert is not. |
|
|
| Report Abuse |
|
|
|
| 14 Nov 2012 02:15 AM |
| For clarification, you cannot make read-only tables. Only ROBLOX can. |
|
|
| Report Abuse |
|
|
Quenty
|
  |
| Joined: 03 Sep 2009 |
| Total Posts: 9316 |
|
|
| 14 Nov 2012 02:17 AM |
| I'm pretty sure using metatables you can create read-only tables. |
|
|
| Report Abuse |
|
|
| |
|
TeamDman
|
  |
| Joined: 04 Dec 2009 |
| Total Posts: 897 |
|
|
| 14 Nov 2012 06:07 AM |
But this leaves the question : How did Seranok use this to update his game? O_O
§TeamDman§ Anti-Jared |
|
|
| Report Abuse |
|
|
|
| 14 Nov 2012 06:21 AM |
@Quenty: You can use metatables to create somewhat read-only tables, but they will still be able to use rawset and table.insert with them.
@TeamDman: That's what I want to know .-. |
|
|
| Report Abuse |
|
|
|
| 14 Nov 2012 07:49 AM |
| l0l ive been spending my whole morning at Script Builder table.inserting stuff into Instance. :P |
|
|
| Report Abuse |
|
|
SN0X
|
  |
| Joined: 24 Oct 2011 |
| Total Posts: 7277 |
|
|
| 14 Nov 2012 10:35 AM |
table.foreach(Instance, print)
?? |
|
|
| Report Abuse |
|
|
|
| 14 Nov 2012 11:03 AM |
table.insert(Instance, (function(t) Instance.new('Message', Workspace).Text = t end))
Instance[1]'hi'
o3o |
|
|
| Report Abuse |
|
|
SN0X
|
  |
| Joined: 24 Oct 2011 |
| Total Posts: 7277 |
|
|
| 14 Nov 2012 02:12 PM |
Seranok, HANDS UP FOO!
It's over! We've caught you! (well julien made u catch urself but wtver k)
TELL US HOW U DID IT! *slaps* FOO!
|
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 14 Nov 2012 03:19 PM |
| Here's a question. Since they've removed scripts' shared scopes to stop hijacking, is the Instance and related objects universally used, or are different copies used per script/thread? |
|
|
| Report Abuse |
|
|
1waffle1
|
  |
| Joined: 16 Oct 2007 |
| Total Posts: 16381 |
|
|
| 14 Nov 2012 03:21 PM |
um..
table.insert(table, ["insert"]=function(x) print("lol, you can't insert "..tostring(x or "userdata").." into this table!") end)
:3 |
|
|
| Report Abuse |
|
|
|
| 14 Nov 2012 03:58 PM |
@1waffle1
table, string, coroutine and all the other Lua libraries are userdata, not read-only tables. In normal Lua, they're normal tables. However, in ROBLOX, there are also read-only tables, which themselves are not the same thing as normal tables, and which are not used for the Lua libraries, though they are used for the Instance, Vector3, etc tables. |
|
|
| Report Abuse |
|
|
1waffle1
|
  |
| Joined: 16 Oct 2007 |
| Total Posts: 16381 |
|
|
| 14 Nov 2012 04:02 PM |
| table.insert(Vector3, ["new"]=function(x,y,z) Instance.new("Message", workspace).Text = "lol look at this noob trying to create a vector3 at "..x..", "..y..", "..z.." lol what a noob." end) |
|
|
| Report Abuse |
|
|
zars15
|
  |
| Joined: 10 Nov 2008 |
| Total Posts: 9999 |
|
|
| 14 Nov 2012 04:05 PM |
| @waffle. Now just to inject it in random roblox clients.. |
|
|
| Report Abuse |
|
|
|
| 14 Nov 2012 04:07 PM |
| table.insert's second argument must be a number. |
|
|
| Report Abuse |
|
|