Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

attempt to call a nil value (method 'setCallback') #3622

Open
dschuessler opened this issue Mar 21, 2024 · 0 comments
Open

attempt to call a nil value (method 'setCallback') #3622

dschuessler opened this issue Mar 21, 2024 · 0 comments

Comments

@dschuessler
Copy link

Steps to reproduce:

  1. Copy the following code into your init.lua
local vpnServiceName = "VPN"

-- Autoconnect VPN
local function connectToVPN()
    hs.execute("networksetup -connectpppoeservice '" .. vpnServiceName .. "'")
end

local networkWatcher = hs.network.configuration:setCallback(connectToVPN)
networkWatcher:start()
  1. Reload the config.

Actual behavior: The following error is logged to the console.

2024-03-21 20:53:42: -- Lazy extension loading enabled
2024-03-21 20:53:42: -- Loading ~/.hammerspoon/init.lua
2024-03-21 20:53:42: -- Loading extension: network
2024-03-21 20:53:42: *** ERROR: /Users/xxx/.hammerspoon/init.lua:8: attempt to call a nil value (method 'setCallback')
stack traceback:
	/Users/xxx/.hammerspoon/init.lua:8: in main chunk
	[C]: in function 'xpcall'
	...poon.app/Contents/Resources/extensions/hs/_coresetup.lua:723: in function 'hs._coresetup.setup'
	(...tail calls...)

Expected behavior: No error is logged to the console since I call setCallback as it is described in the docs.

Hammerspoon version: 0.9.100 (6815)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant