by martijn_himself · 10y ago · 0 comments
At http://www.hammerspoon.org/go/#colonsyntax it mentions the following calls are identical:
win:frame()
hs.window.frame(win)
My Lua knowledge is a bit rusty but should the second line not be:
win.frame(win) ?
local win = hs.window.focusedWindow()
local f = win:frame()
win is presumable a copy ("instance") of the table hs.window created by focusedWindow().Meaning hs.window.focusedWindow() returns a copy of the hs.window table.
With that being said, win.frame(win) would just be hs.window.frame(win), so you're also correct. It's just a poorly worded example explaining Lua's colon syntax feature.
As for JavaScript, my opinion is that Lua is everything JavaScript should have been: A clean, minimal, sanely designed, language. JavaScript on the other hand is nothing but mistakes piled upon mistakes. It's really disheartening to see JavaScript get shoved into places Lua fits better, like as Gnome Shell's scripting language. Oh well.