Posts by accv • 76 points
3 posts
-
2
votes1
answer388
viewsA: How to read a file in the same script directory using Lua
You can do it: for linhas in io.lines("input-lab.txt") do print(linhas) end or local f = "input-lab.txt" for linhas in io.lines(f) do print(linhas) end or local f = io.lines("input-lab.txt") for…
-
1
votes1
answer58
viewsQ: How do I make a command with substring?
How do I substring with a command (ultilizing io.read)? example: io.read() question I say, Say Hello World then the console "printa" "Hello World". "Say" is the command "Hello World" is the…
-
3
votes2
answers1273
viewsQ: What is the difference between "in pairs" and "in ipairs" in Lua?
produtos = { arroz = 10, feijao = 15 } for produtos, valor in pairs(produtos) do print(produtos .. " custa R$" .. valor) end Returns: feijao custa R$15 arroz custa R$10 But when I use the "ipairs"…