Jump to content

Turbe$Z

Recommended Posts

Posted
local table = {
	{"1", "2", "3", "4"},
}

function asdasdsdasdd()
table.insert(table,"5","6","7","8")
end

What wrong? No errors and warnings in debugscript 3...

Posted (edited)

Because table.insert inserts only 1 value to table.

In your case you should use for loop and call table.insert per iteration.

Please read Lua docs:

 

Edited by Kenix
  • Like 1
Posted
2 hours ago, Kenix said:

Because table.insert inserts only 1 value to table.

In your case you should use for loop and call table.insert per iteration.

Please read Lua docs:

 

Ah, can you show me a example, please?

Posted
local table = {
    {"1", "2", "3", "4"},
}

function startInsert()

for k=5,8 do
table.insert(table,tostring(k))

end
end

startInsert()

 

  • Like 1

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