https://github.com/uriid1/lua-format-string
https://github.com/uriid1/lua-format-string
lua luajit tarantool
Last synced: 1 day ago
JSON representation
- Host: GitHub
- URL: https://github.com/uriid1/lua-format-string
- Owner: uriid1
- License: mit
- Created: 2026-06-23T14:36:02.000Z (11 days ago)
- Default Branch: master
- Last Pushed: 2026-06-23T14:41:36.000Z (11 days ago)
- Last Synced: 2026-06-23T16:28:37.600Z (11 days ago)
- Topics: lua, luajit, tarantool
- Language: Lua
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Lua format string
String interpolation with support for table field lookups.
```lua
local f = require('f')
local person = { priv = { age = 27 } }
local name = 'Alex'
do
local name = 'Urii'
print(f'Name: ${name} | Person age: ${person.priv.age}') -- Name: Urii | Person age: 27
end
```
Variables are resolved from the current lexical scope, and nested table fields can be accessed using dot notation.
## Alternatives
* [fstring via gsub](https://gist.github.com/uriid1/2b7823c096b3a697ceab7f40b4ccc54b)
* [fdiv via mt](https://gist.github.com/uriid1/57356bf8618d78587f2f8515d8b2ab0f)