Hi
In the most simplest way. How do i call my table entries from a separate file
Its going to be a big list so id rather not put into main.lua
Currently:
Main.lua calls it by table entries on
t = {“test”,“test2”}
And id put something like
Print(t[1]) to display “test”
But i want to populate and call the table t in something like table.lua and call the print function from main.lua
[import]uid: 43191 topic_id: 7944 reply_id: 307944[/import]
jmp909
2
tableData.lua
[lua]module(…, package.seeall)
table1 = { “hello”, “there”, “mister” }
table2 = { a=“apple”, b=“banana” c=“cat”}[/lua]
main.lua
[lua]local tableData = require(“tableData”)
local t1 = tableData.table1
local t2 = tableData.table2
print(t1[2]) – “there”
print(t2[“a”]) – “apple”
print(t2.c) – “cat”[/lua]
[import]uid: 6645 topic_id: 7944 reply_id: 28324[/import]
Brilliant that works ! [import]uid: 43191 topic_id: 7944 reply_id: 28368[/import]