https://github.com/jun-labs/lua-script
🔵 Learning lua-script.
https://github.com/jun-labs/lua-script
busted lua lua-script luaunit redis script
Last synced: 2 months ago
JSON representation
🔵 Learning lua-script.
- Host: GitHub
- URL: https://github.com/jun-labs/lua-script
- Owner: jun-labs
- Created: 2024-09-09T10:15:21.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-09-20T10:41:25.000Z (9 months ago)
- Last Synced: 2025-02-12T02:09:42.990Z (4 months ago)
- Topics: busted, lua, lua-script, luaunit, redis, script
- Language: Lua
- Homepage:
- Size: 80.1 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Learning Lua
[](https://www.lua.org/) [](https://www.lua.org/docs.html)
[](https://github.com/lunarmodules/busted)
[](https://www.tutorialspoint.com/lua/index.htm) [](https://github.com/luarocks/lua-style-guide)
# Install
Before learning Lua, please make sure to correctly install the following modules. (For Mac with AMD chip)
```shell
$ brew install lua # Lua
$ brew install luajit # LuaJit
$ brew install luarocks # LuaRocks
$ luarocks install luaunit # LuaUnit
$ luarocks install busted # Busted
$ luarocks install redis-lua # Redis Lua
```
If you want to know information about a package, you can run the following command.
```shell
$ luarocks show luaunit
LuaUnit 3.4-1 - A unit testing framework for Lua
...
Installed in: /opt/homebrewModules:
luaunit (/opt/homebrew/share/lua/5.4/luaunit.lua)
export LUA_PATH="/opt/homebrew/share/lua/5.4/?.lua;;"
```
# Run
To run the Lua script, navigate to the folder where your file is located and execute the following command.
```shell
$ pwd # 1. Current directory
/lua-script/basic$ ls # 2. Check directories
chunk string_library$ cd string_library # 3. Navigate to target directory
$ lua main.lua # 4. Execute lua
```
To run the tests, navigate to the folder where your test file is located and execute the following command.
```shell
$ pwd # 1. Current directory
/lua-script/basic$ ls # 2. Check directories
chunk string_library$ cd string_library # 3. Navigate to target directory
$ lua test_luaunit.lua # 4. Execute test(luaunit)
......
Ran 6 tests in 0.000 seconds,
6 successes, 0 failures OK
``````shell
$ pwd # 1. Current directory
/lua-script/basic$ ls # 2. Check directories
chunk string_library$ cd string_library # 3. Navigate to target directory
$ busted test_busted.lua # 4. Execute test(busted)
●●●●●●●●●●●
11 successes / 0 failures / 0 errors / 0 pending : 0.005014 seconds
```
If your test uses Redis, please execute the following Docker Compose command before running the program, and ensure that the required port 6379 is not already in use to avoid any conflicts.
```yaml
version: "3.8"
services:
redis:
image: redis:latest
ports:
- "6379:6379"
``````shell
$ docker-compose up -d
```