I'm working on making a 2D tile-based game, and I believe that storing Vector2's in a table to find the information of a tile would be quite useful. To explain better, this is what I'm trying to do:
local worldData = {
tiles = {
Vector2.new(0, 1) = "wall"
}
}
I've tried both without and with the '.new', but to no success. The wiki explains that "both the key and value can be any Lua value (numbers, strings, Parts etc., and even other tables) except nil." Sadly the wiki does not provide any example of setting the key to a data type besides a string and integer.
As a side question, I've also noticed that you can't manually add in a Vector2, along with many other values, to objects in Roblox Studio's explorer. Any way to do that?

2 comments
Cool. So the Vector is added as a key to the table. How do I read its value? I've attempted print(worldData.tiles[Vector2.new(0,1)]) as well as other things to no luck.
You can't do that since the key is the identity of the vector itself and not the 0,1. One thing you could do is set the key to
["0, 1"]and indextilesby doingworldData.tiles[tostring(Vector2.new(0, 1)]