Learn to Code via Tutorials on Repl.it!

← Back to all posts
using io.open for useful things (LUA)
Metacalled (3)

So not many people have explored the easily file creation inside of Lua,

Lua is one of the most simple yet fastest and efficient languages used in such games as Roblox and Garry's mod. The things you can do with lua (even though its just a simple language is amazing.)

I've made a function re-made from a ROBLOX exploit known as "Synapse X", the function is "writefile", you can see the repl i have used below.

to make a simple writefile function you simply use io.open() like so:
local variable = io.open("filename.lua", "w")
-- variable is now what you'll use to edit the io.open we just made.

variable:write("Text here") -- writes "Text here" in the file.
variable:close() -- ends the writefile process

Simple yet so useful! Have fun.