stujones11 / shooter

First Person Shooter Mod for Minetest
Other
30 stars 18 forks source link

Style Question #18

Closed raymoo closed 5 years ago

raymoo commented 8 years ago

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

local function thing_name(...)
  return shooter:thing_name(...)
end
rubenwardy commented 8 years ago

You could do

shooter:thing(...)
local thing = shooter.thing
thing(shooter, ...)
raymoo commented 8 years ago

Sure, but then there's an extra meaningless argument that needs to be included every time.

stujones11 commented 8 years ago

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.

raymoo commented 8 years ago

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.

stujones11 commented 5 years ago

Since the 0.6.0-dev branch breaks the current (non-existent api) it may be a good time to make this change.

stujones11 commented 5 years ago

d65776685fd507868a60fe4bbd780214b19e168c

rubenwardy commented 5 years ago

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

HybridDog commented 5 years ago

You're right, sorry. The similarity in the version numbers confused me.