feat: add string data type api

This commit is contained in:
Ibrahim Abdulhameed committed 2025-09-01 11:59:47 +01:00
1 parent 99d67fa4cb
commit 0b4e2075e4
1 file changed
+33
+33
View File
@@ -78,6 +78,8 @@ Lua is a dynamically typed language and hence only the values will have types no
| `thread` | Represents independent threads of execution |
| `table` | key-value pair, or array. |
See: [Data Types](#data-types)
## Operators
### Arithmetic
@@ -151,3 +153,34 @@ true or false --> true
not true --> false
```
## Data Type APIs
### Strings
```lua
s = "Hello"
-- concatenation
s .. " there" -- => Hello there
s:upper() -- => HELLO
s:lower() -- => hello
s:len() -- => 5
s:find("o") -- => 5
s:reverse() -- => olleH
-- others
s:match()
s:gmatch()
s:sub()
s:gsub()
s:rep()
s:char()
s:dump()
s:byte()
s:format()
```