Jump to content

Table


MaxMoss

Recommended Posts

Hello
I want to create a table like this:
table = {

[1] = {},

[2] = {},

[3] = {},

}
And I want to change table 3 to table 2 when table 2 is deleted
table = {

[1] = {},

--[2] = {},

[2] = {},

}

Sorry for my English, I took help from Google Translate

Link to comment

not sure but try using table.remove

local tables = {

[1] = {},

[2] = {},

[3] = {},

}

table.remove(tables, 2) --remove 2. nested table

for i,v in ipairs(tables) do 
   print(i,v)    
end

--[[
--normally
1	table: 0x5598d3662e90
2	table: 0x5598d3661670
3	table: 0x5598d36616b0
-- after table remove
1	table: 0x555c01b1c6b0
2	table: 0x555c01b1c6f0
]]--

 

Edited by Burak5312
  • Thanks 1
Link to comment

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...