Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do you remove a value that is in Square Brackets?

Suppose I write this..... (Description in script...)

--local tbl1 = {}
--
--tbl1["hi"] = 1

--for i,v in pairs(tbl1) do
--	print(i)
--	print(v)
--end
--
--table.remove(tbl1,1)
--
--for i,v in pairs(tbl1) do---Still Prints Hi For Some Reson.....?
--	print(i)
--	print(v)
--end


--Other Attempt!
-----------------------------------------
----------------------------------------

--for i,v in pairs(tbl1) do
--	print(i)
--	print(v)
---table.remove(tbl1,i) --- Returns: 15:16:27.312 - Players.Tizzel40.PlayerGui.LocalScript:25: bad argument #2 (number expected, got string)
--end
--


--Please Help Me!

How Do I get rid of "hi"? Is it possible with table.remove() ?

3 comments

0

In Lua you would set the value to nil. e.g. tbl1["hi"] = nil

0

really???

0

hmmm ok thanks!

1 answer

✓ Accepted answer
tbl1.hi = nil

You don't use table.remove because tbl1 is not an array.

This discussion is preserved as it was. New answers, comments, and votes are closed.