Closed raymoo closed 5 years ago
You could do
shooter:thing(...)
local thing = shooter.thing
thing(shooter, ...)
Sure, but then there's an extra meaningless argument that needs to be included every time.
It is just a style preference though I had not considered the effect on localization. I am yet to be convinced there is any real performance benefit from so doing but will consider changing it to the 'dot' notation in a future update.
There probably isn't a significant performance benefit since none of those functions are ones you would call frequently, but someone could be lazy and want to use the function with an abbreviated name. I think this is fairly low-priority.
Since the 0.6.0-dev branch breaks the current (non-existent api) it may be a good time to make this change.
d65776685fd507868a60fe4bbd780214b19e168c
He's probably talking about Shooter 0.6.0.
Please do not link people to malicious sites like that. That fork is not officially associated with Minetest in any manner. The author has been permanently banned by both Freenode and Minetest for spam, harrassment, and doxing, among other things. We recommend avoiding any contact, to avoid becoming one of his victims
You're right, sorry. The similarity in the version numbers confused me.
You use shooter:thing_name for all of your table-contained functions, but you never actually use the self parameter to refer to the shooter table, so it would work as just shooter.thing_name instead (other than backwards compatibility). Is this just a style preference? It does mean you cannot simply do
local thing_name = shooter.thing_name
to "localize" the function, rather you have to do