Arrow functions don't have this binding by design. Despite that, the following:
let setWallpaper = (screenNumber: number) => {
if (!beautiful.wallpaper) {
return;
}
// If wallpaper is a function, call it with the screenNumber
const wallpaper = typeof beautiful.wallpaper == "function"
? beautiful.wallpaper(screenNumber)
: beautiful.wallpaper;
gears.wallpaper.maximized(wallpaper, screenNumber, true);
};
is transpiled to:
local setWallpaper
setWallpaper = function(____, screenNumber)
if not beautiful.wallpaper then
return
end
local wallpaper = (type(beautiful.wallpaper) == "function") and beautiful.wallpaper(screenNumber) or beautiful.wallpaper
gears.wallpaper.maximized(wallpaper, screenNumber, true)
end
I think that let setWallpaper = (screenNumber: number) => {... should transpile to:
local setWallpaper
setWallpaper = function(screenNumber)
if not beautiful.wallpaper then
return
end
local wallpaper = (type(beautiful.wallpaper) == "function") and beautiful.wallpaper(screenNumber) or beautiful.wallpaper
gears.wallpaper.maximized(wallpaper, screenNumber, true)
end
Arrow functions don't have
thisbinding by design. Despite that, the following:is transpiled to:
I think that
let setWallpaper = (screenNumber: number) => {...should transpile to: