A short list of gripes I have with lua as a language

in #programming4 years ago
  • Spotty IDE support: as far as my own expirence has shown, lua seems to have very flaky IDE support even for basic syntax checking.

  • Baked in API: this somewhat plays into the first issue wherein due to lua regularly being embedded in applications a lot of functions are not accessible and need stubs in order to work in an IDE.

  • The way it defines scopes using a "start phrase" and the word "end": this is a gripe of its syntax, wherein it can become mentally taxing to read if you have multiple nested "scopes". This is because you must be able to hold in your mind where one scope ends and another begins.
    Example of this below

function IndexedMinPQ:swim(k)
    while k > 1 do
        local parent = math.floor(k / 2)
        if self:less(self.keys[self.pq[k]], self.keys[self.pq[parent]]) then
            self:exchange(self.pq, k, parent)
            self.qp[self.pq[k]] = k
            self.qp[self.pq[parent]] = parent
        else
            break
        end
    end

end

At a first glance you might make the mistake of thinking the second end closes the function, this is what i mean by mentally taxing.

Sort:  

That's funny, at first glance, it looks like python code

tbh it kind of functions that way implicitly its when you have functions inside of functions in a callback like structure

myRightClickLabel:setMenuAction("Drink.ManaPotion", function()
    cecho("<blue>Drinking my mana potion.\n")  
    send("drink mp") 
 end )

Where stuff gets messy because of the "end"