如何对表格进行 string.find 操作?

我该如何对表格进行 string.find 操作呢?

我的代码:

WEAPON_TABLE = { -- 我需要检查这些武器的 weaponclass
    "swep_1",
    "swep_2",
    "swep_3"
}

if string.find(v:GetWeaponClass(), ???) then
    --
end
点赞
用户107090
用户107090

尝试一下:

WEAPON_TABLE = {
    ["swep_1"]=true,
    ["swep_2"]=true,
    ["swep_3"]=true,
}

如果玩家手持的武器在 WEAPON_TABLE 表中,则执行以下代码:
2021-02-06 00:55:46