Skip to content

Instantly share code, notes, and snippets.

@dongyuwei
Last active October 17, 2022 07:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dongyuwei/71eb81395def3640048b16c268bfdc68 to your computer and use it in GitHub Desktop.
Save dongyuwei/71eb81395def3640048b16c268bfdc68 to your computer and use it in GitHub Desktop.
test inspect.lua and http request with luasocket
local inspect = require('inspect')
local http = require("socket.http")
inspect(http)
r, c, h = http.request('https://www.baidu.com/')
print(r)
print(c)
inspect(h)
@dongyuwei
Copy link
Author

setup lua env(LUA_PATH, LUA_CPATH)
luarocks path --bin

cat ~/.config/fish/config.fish

set -gx LUA_PATH '/usr/local/share/lua/5.4/?.lua;/usr/local/share/lua/5.4/?/init.lua;/usr/local/lib/lua/5.4/?.lua;/usr/local/lib/lua/5.4/?/init.lua;./?.lua;./?/init.lua;/Users/yuwdong/.luarocks/share/lua/5.4/?.lua;/Users/yuwdong/.luarocks/share/lua/5.4/?/init.lua'

set -gx LUA_CPATH '/usr/local/lib/lua/5.4/?.so;/usr/local/lib/lua/5.4/loadall.so;./?.so;/Users/yuwdong/.luarocks/lib/lua/5.4/?.so'

set -gx PATH '/Users/yuwdong/.luarocks/bin:/Users/yuwdong/.asdf/shims:/usr/local/opt/asdf/libexec/bin:/Users/yuwdong/Downloads/jdk-11.0.2.jdk/Contents/Home/bin:/Users/yuwdong/.cargo/bin:/Users/yuwdong/.bun/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/usr/local/share/dotnet:~/.dotnet/tools:/usr/local/go/bin:/Library/TeX/texbin'

install packages using luarocks

luarocks install inspect --local
luarocks install luasocket --local

@dongyuwei
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment