Little problem with tables (SOLVED)

i have two tables

{ 
  4 = { --[[0000024FFCFD0DF0]]
    1 = 12,
    2 = 7
  }
}
  
{  
  1 = { --[[0000024FFD03A610]]
    usr = 2,
    menu = "attack",
    opt = "top_weapon",
  }
 } 

i want get this

{  
  1 = { --[[0000024FFD03A610]]
    usr = 2,
    menu = "attack",
    opt = "top_weapon",
  },
  
  2 = { --[[0000024FFD040C60]]
    usr = 4,
    state = { --[[0000024FFD040CB0]]
      1 = 12,
      2 = 7
    }
  }
 }

Please help me

	local t1 = { 
		[4] = {
			[1] = 12,
			[2] = 7
		}
	}

	local t2 = {
		[1] = {
			usr = 2,
			menu = "attack",
			opt = "top_weapon",
		}
	}

	-- use next() to get the next key in t1 (ie the 4)
	local usr = next(t1)
	local t = {
		[1] = t2[1],
		[2] = {
			usr = usr,
			state = t1[usr]
		}
	}
1 Like

Thank you britzl

I still can’t get used to the tricky tables ((