Is there a way of loading a table from a module? I am making a dictionary app, and a have a table with all the words in. I want to have this stored in a module, and then require it in when needed. How do I do this? [import]uid: 116264 topic_id: 27788 reply_id: 327788[/import]
There sure is.
Here is an example
–words.lua
local words = {}
--Table to store words
words.list = {
"the", "cow", "sheep"
}
return words
–Any file.lua
[code]
local words = require(“words”)
print( words.list ) – Prints table
print ( words.list[1] ) – Would print ‘The’
[/code] [import]uid: 84637 topic_id: 27788 reply_id: 114757[/import]