feat: add io

This commit is contained in:
Ibrahim Abdulhameed committed 2025-09-01 12:32:09 +01:00
1 parent 53a81eebae
commit af56bbb0d2
1 file changed
+24 -12
+24 -12
View File
@@ -53,18 +53,6 @@ boys, girls = 2, 3 -- global variables
Lua is a dynamically typed language and hence only the values will have types not the variables.
### Comments
```lua
-- This is a single line comments
```
```lua
--[[
Comments (multi-line) could also be written like this
--]]
```
### Data Types {.col-span-2 .row-span-2}
| Value Type | Description |
@@ -80,6 +68,30 @@ Lua is a dynamically typed language and hence only the values will have types no
See: [Data Types](#data-types)
### IO
```lua
-- Writes data to the standard output or a file.
io.write("Enter your name: ")
-- Reads input from the user or a file. You can specify formats like "*l" (line), "*n" (number), or "*a" (all).
name = io.read()
io.write("Enter your age: ")
age = io.read()
```
### Comments
```lua
-- This is a single line comments
```
```lua
--[[
Comments (multi-line) could also be written like this
--]]
```
## Operators
### Arithmetic