# [Help]Table Problem

## Recommended Posts

Hello,Today I've made a Marker which Create Random,from table

Can u fix this plz ?!

```mine_pos =
{
{271.94140625, 1350.1923828125, 10.5859375},
{275.94140625, 1350.1923828125, 10.5859375},
}
mineplace = createMarker(mine_pos[1],mine_pos[2],mine_pos[3])```

```
local mine_pos = {
{271.94140625, 1350.1923828125, 10.5859375},
{275.94140625, 1350.1923828125, 10.5859375}
}
local n = math.random(1,#mine_pos)
local mineplace = createMarker(mine_pos[n][1],mine_pos[n][2],mine_pos[n][3])

```

```
local mine_pos = {
{271.94140625, 1350.1923828125, 10.5859375},
{275.94140625, 1350.1923828125, 10.5859375}
}
local n = math.random(1,#mine_pos)
local mineplace = createMarker(mine_pos[n][1],mine_pos[n][2],mine_pos[n][3])

```

Thanks it's working

Just addition, you can change 'math.random(1,#mine_pos)' to 'math.random(#mine_pos)', does the same thing

If you want a quicker version, you could use this(it's up to you though, maybe you prefer the easier to understand one)

```mine_pos =
{
{271.94140625, 1350.1923828125, 10.5859375},
{275.94140625, 1350.1923828125, 10.5859375},
}
mineplace = createMarker(unpack(minepos[math.random(#mine_pos)]))
```

This will only work if you keep the arrays x, y, z coordinates only though.

If you want a quicker version, you could use this(it's up to you though, maybe you prefer the easier to understand one)
```mine_pos =
{
{271.94140625, 1350.1923828125, 10.5859375},
{275.94140625, 1350.1923828125, 10.5859375},
}
mineplace = createMarker(unpack(minepos[math.random(#mine_pos)]))
```

This will only work if you keep the arrays x, y, z coordinates only though.

Thanks

## Create an account

Register a new account