#why wtf is stuff in the array showing up as nil instead of just being removed from the table

42 messages · Page 1 of 1 (latest)

fathom mirage
#

Try table.remove()

hasty frost
#

table.remove doesnt work on dictionaries

#

i just wanna set the key to nil this usually works but not now for some reason wtf

fathom mirage
#

As long as you have the value

#

Your owners[k] = nil is the same as doing table.remove(owners, k)

hasty frost
#

but im p sure table.remove doesnt work on mixed tables

#

if i was to make one of the ids values another table table.remove wont do anything to the table its in

fathom mirage
#

as long as it's a table you can use table.remove 😭

#

The thing with remove is you have to find the index for the specific item you want to remove

#

So my example doesn't work

hasty frost
#

ok let me test rq if table remove even works

#

ok it works

#

again tho ima make it a mixed table later if table remove doesnt work on that ima be pissed

fathom mirage
#

It would be something like this:

local Table = {

  ["Foo"] = {["Boolean"] = false, nil, "string", 12345}   

}

table.remove(Table.Foo, table.find(Table.Foo, "Boolean"))
#

That will remove the "Boolean" index

#

If you didn't name your index (which you did), you'd want to use table.find()

#

Hold on let me give u a better example for your scenerio

hasty frost
#

setting the table key to nil is a standard practice idk why i have to use table.remove in this instance

#

confused

fathom mirage
#

Actually you can just use table.remove without using table.find

#

Since you're using a for loop

#

table.remove(Table.Foo, value)

hasty frost
fathom mirage
#

LMAO

#

I mean it removes the value from the table without leaving anything

fathom mirage
#

So the issue?

#

Your original problem was it leaving nil behind?

hasty frost
#

yes

#

it works here not in the other script

#

it just shows up in the table as nil instead of being removed

#

wtf is even going on bro

#

i give up

#

@fathom mirage what is this

fathom mirage
#

Ok what?

hasty frost
#

i dont think u understand