diff --git a/source/_posts/lua.md b/source/_posts/lua.md index a67b8da..e3f988f 100644 --- a/source/_posts/lua.md +++ b/source/_posts/lua.md @@ -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