I’m trying to migrate my data table to an external module.
It’s working just fine as is but I will be adding a lot of data later on.
So ideally i would like to separate the data table so I can just modify the data table without touching other elements in main.lua by mistake.
I believe this is a job for a module (separate .lua file, as I understand) but I can’t figure out how to achieve this. There are some tutorials/ documentations but some of them say they are outdated. So I’m not sure where to start.
Currently my data table looks something like this;
local Data ={}
Data[1].name = “AAAA”
Data[1].detail = “BBBB”
Data[2].name = “CCCC”
Data[2].detail = “DDDD”
Data[3].name = “EEEE”
Data[3].detail = “FFFF”
And I would like to …
-A ) migrate the Data={} data table to another .lua file
while
-B ) the variable “Data” and individual data items are still accessible from main.lua
Thaks!
Leo