Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR LUA

how to delete a key in a table lua

local test = {"a", "b", "c"}

local function removeKey(tbl, key)
	for k,v in pairs(tbl) do
    	if (v == key) then
        	table.remove(tbl, key)
        end
    end
end

removeKey(test, "c")
 
PREVIOUS NEXT
Tagged: #delete #key #table #lua
ADD COMMENT
Topic
Name
6+6 =