gpt4 book ai didi

lua - 获取错误 "Attempted to index global ' 表'(零值)“Lua

转载 作者:行者123 更新时间:2023-12-02 18:05:42 26 4
gpt4 key购买 nike

当我在 Lua 中运行此代码片段时(如果有帮助,请使用 PICO-8)

a = {}
table.insert(a,1,'foo')

我收到错误

Attempted to index global "table" (a nil value)

根据 Lua 网站,这应该可以工作( https://www.lua.org/pil/19.2.html )。我做错了什么?

最佳答案

Lua 无法解析 table.inserttable 部分。这很可能是因为您的主机环境不包含表标准库。

由于 Lua 是一种“嵌入式”语言,其大部分标准库都是可选的,如果环境决定排除它,则可能不可用。

特别是对于 PICO-8:

PICO-8 does not include the Lua standard library, and instead providesa proprietary collection of global functions.

Source

关于lua - 获取错误 "Attempted to index global ' 表'(零值)“Lua,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73299942/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com