Lua data saving

How would I save data with Lua?
Pretty much how would I run shell using a lua script.
I could add another file to use as a library, but I haven’t taken the time to learn bash or anything like that. I’m making a text-based stardew valley, and I want to save data for convince.

Hello @TheExoticBone welcome to the community!

About running shell commands, Lua provides the os.execute function for that purpose:

os.execute("ls") -- for example, ls you list the directory

But since you are making a text-based game saving game data to a file or a simple database should be sufficient enough. You probably don’t need to execute shell commands.

And about saving data, pretty much every tutorial on the web will provide you with the info, but a little example:

local file ="save_file.txt", "w") -- you open in write mode
if file then
    file:write("Hello replit") -- so you write data to the file
    file:close() -- and it's important to close when done