Skip to content

Instantly share code, notes, and snippets.

@ikouchiha47
Created February 18, 2024 10:58
Show Gist options
  • Save ikouchiha47/48b8696fd62278a25b613a9105db0fdf to your computer and use it in GitHub Desktop.
Save ikouchiha47/48b8696fd62278a25b613a9105db0fdf to your computer and use it in GitHub Desktop.
-- src/setup.lua
local version = _VERSION:match("%d+%.%d+")
package.path = 'lua_modules/share/lua/' .. version ..
'/?.lua;lua_modules/share/lua/' .. version ..
'/?/init.lua;' .. package.path
package.cpath = 'lua_modules/lib/lua/' .. version ..
'/?.so;' .. package.cpath

setup.sh

#!/bin/bash

if [[ $(uname) == "Darwin" ]]; then
  brew install lua luarocks
fi

mkdir -p project/src
cd project/
touch src/main.lua

luarocks init --lua-versions "5.1,5.2,5.3,5.4"
touch src/setup.lua

running

lua -l src/setup.lua src/main.lua
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment