--[[Say for example the player types :ban Player1 the game will run search for the player, and if it isnt nil, it will type
table.insert(BanList, PlayerName)
]]
local BanList = {"Player1", "Player2", "Player3"}
--When a player types :unban Player1, it will search the table with the following code
elseif msg:lower():sub(1,7) == Prefix.."unban " then
local CharName = msg:lower():sub(8)
local Length = CharName:len()
for i,v in pairs(RealTimeList) do
if v:lower():sub(1, Length) == CharName:lower():sub(1, Length) then
table.remove(RealTimeList, v)
end
end
After this command, I realized I cannot remove tables with its string/name, I need to use an INT value, such as its table position, but how do I find a tables position in Lua?
For example if the table was like this
local Table = {"Player1", "Player2", "Player3"}
and I wanted to ban Player3, this is how I’d do it according to wiki
table.remove(Table, 3)
but the position of the name in the table is 3, so how would I detect that position?