Jump to content

help table lua


ilnaz

Recommended Posts

Posted

markerData = {

location = '1', {
[1] = { 1216, -1835, 13.4},
[2] = { 1227.7, -1854.6, 13.4},

},

location = '2', {
[1] = { 0, 0, 0},
[2] = { 1227.7, -1854.6, 13.4},

},

location = '3', {
[1] = { 1216, -1835, 13.4},
[2] = { 1227.7, -1854.6, 13.4},
},
}


local selLocation = 2

for _,tab in pairs(markerData) do
    if tab['location'] == selLocation then
        local x, y, z = markerData[ID][1], markerData[ID][2], markerData[ID][3]  -- Problem markerData[ID][1]
        
    end
end

Posted

I would refer you to 

Specifically, use code markings to make the code readable

MSHAyJ3.png

and tell us what the problem is, don't just paste your code. Tell us what is your issue, any errors you get, and what the intended behaviour is.

Posted
local selLocation = 2
markerData = {
	[1]= {
		[1] = {1216, -1835, 13.4},
		[2] = {1227.7, -1854.6, 13.4}
	},
	[2] = {
		[1] = {0, 0, 0},
		[2] = {1227.7, -1854.6, 13.4}
	},
	[3] = {
		[1] = { 1216, -1835, 13.4},
		[2] = { 1227.7, -1854.6, 13.4}
	}
}

for index,value in pairs(markerData[selLocation]) do
	local x, y, z = value[1], value[2], value[3]
        
end

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...