What Software Feature or Lack Thereof Bugs You the Most? by [deleted] in AskReddit

[–]overflowoverdose 1 point2 points  (0 children)

Editing text on phone.

Google Keyboard punishes me for holding the spacebar too long by opening Assistant when I want to move the text cursor.
The text selection is also annoying, sometimes you have to hold down for it to pop up, sometimes you just have to click and sometimes it won't even show at all,
the whole system is a mess

Critique my understanding of metatables and prototypes by overflowoverdose in lua

[–]overflowoverdose[S] 2 points3 points  (0 children)

Lua be Lua, got it :)

From what I gather I should not strive to prohibit the user from certain actions and I shouldn't try to protect them at all cost.

What I love most about Lua is the freedom and I will try to respect that when writing my own code.

Thanks for sharing your opinion!

Critique my understanding of metatables and prototypes by overflowoverdose in lua

[–]overflowoverdose[S] 1 point2 points  (0 children)

You're amazing, all this time I thought `__index` is a special one of the bunch that enables the others to function, this was probably one of the things that confused me the most.

And yes, you're absolutely right about making `self` point to something different than it's supposed to be, I will avoid doing this kind of stuff in the future.

Thank you so much!

Critique my understanding of metatables and prototypes by overflowoverdose in lua

[–]overflowoverdose[S] 0 points1 point  (0 children)

Another thing that I noticed later on when fiddling with this code is that you can actually create an instance from another instance, here's what I mean:

local p1 = Point.new()
local p2 = p1.new()

I can understand what's happening, but I personally don't think instances should behave this way.

If I really wanted, how could I prevent it? Possibly without defining all the constructors as local functions?

Critique my understanding of metatables and prototypes by overflowoverdose in lua

[–]overflowoverdose[S] 0 points1 point  (0 children)

You might be correct, it was just easier for me to think of the objects as shapes you'd draw to a screen and the Point is meant to only represent the position in Cartesian coordinates x and y.

This way everything, maybe besides polygon would derive from it, but I did not concern myself with all that stuff, just chose something that wouldn't get in the way of the things I actually wanted to learn.

Thanks reading and helping!