Skip to content

Instantly share code, notes, and snippets.

@aquaslvt
Last active May 11, 2023 08:24
Show Gist options
  • Save aquaslvt/d184cfd3c8422191829b226e252f5b5e to your computer and use it in GitHub Desktop.
Save aquaslvt/d184cfd3c8422191829b226e252f5b5e to your computer and use it in GitHub Desktop.
Typewriter effect in Lua (unix)
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")!`
@aquaslvt
Copy link
Author

aquaslvt commented Mar 5, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment