将数字放入数组名称中

Array's

blacklistToUse = {
 "f4blu",
 "Shifter_kart",
 "bdivo",
 "mvisiongt",
 "m3tp",
 "atsvme",
 "ktmx",
 "goldwing",
 "s500w222",
 "bs17"
}

steam:110000119172a51 = {
 "atsvme"
}

BlackListToUse 是用户无法使用的自定义模型。默认情况下,对于每个玩家,它们都被锁定。 steam:110000119172a51 是具有访问 atsvme 模型权限的用户。然而,每当我将名称作为他们的 steam id 时,这个脚本就无法运行。

点赞
用户7396148
用户7396148

在你的字符串中的 : 会让 Lua 认为你试图调用一个名为 110000119172a51 的函数,并尝试将变量 steam 传递给该函数。

110000119172a51 是无效的名称,因为它以数字开头。

一个解决方法是:

whitelists = {
    ['steam:110000119172a51'] = {
        "atsvme"
    }
}

-- 示例使用
whitelist['steam:110000119172a51'][1] -- 返回 "atsvme" 字符串

将值包装在表中可以让你使用任何你需要的用户名字符串。

: Lua 语法的资源:Programming in Lua: 16 – Object-Oriented Programming

2019-05-07 21:46:09