Reputation: 95
When I run this code snippet in Lua (using PICO-8 if it helps)
a = {}
table.insert(a,1,'foo')
I get the error
Attempted to index global "table" (a nil value)
According to the Lua website, this should work (https://www.lua.org/pil/19.2.html). What am I doing wrong?
Upvotes: 2
Views: 1074
Reputation: 54589
Lua was unable to resolve the table
part of table.insert
. This is most likely because your host environment does not include the table standard library.
As Lua is an "embedded" language, and most of its standard library is optional and may not be available if an environment decides to exclude it.
For PICO-8 in particular:
PICO-8 does not include the Lua standard library, and instead provides a proprietary collection of global functions.
Upvotes: 5