How to use "If" with tables

I’ve looked for a solution for a while now, so I’m blind, I’m doing it wrong, or I’m doing the wrong thing.
I want to create a list of things to run scripts for how can I do this, one way I’ve tried is this:

table = {"ah","example"}
if table == "example" then
--Run script

Am I doing it wrong or doing the wrong thing?

1 Like

You are comparing a string to an entire table, which obviously will result in false. You want to check if the string is present in the table? You can use table.find for this.

local t = { "ah", "example" }

if table.find(t, "example") then
    -- Run script

Well that explains alot, thanks.