Last active
May 11, 2023 08:24
-
-
Save aquaslvt/d184cfd3c8422191829b226e252f5b5e to your computer and use it in GitHub Desktop.
Typewriter effect in Lua (unix)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function type_out(str) | |
for char in string.gmatch(str, '.') do | |
os.execute("sleep " .. tonumber(0.1)) | |
io.write(char) | |
io.flush() | |
end | |
end | |
-- You can now use `type_out("your string here")!` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you want this to run on Windows, just replace line 3 with:
if n > 0 then os.execute("ping -n " .. tonumber(0.1+1) .. " localhost > NUL") end