July 2018
Beginner
202 pages
5h 42m
English
The require function only loads a file one time. When dealing with modules, this feature is a great way to avoid loading duplicate code. But, when trying to load data, the require function will not re-load data. Loading the same Lua file multiple times can be done using the dofile function. Both dofile and require load a file and execute the code within, but with two major differences:
Let's modify the previous code sample to save some data, load it, save some new data, and then re-load the data. The code needs to change to this: ...