Time Nick Message 19:34 Guest32 ?muteme 1m 21:48 gera why do modders write things like local minetest = minetest 21:48 gera to not accidentally redefine minetest? 21:50 ireallyhateirc making a local copy of a global object apparently makes it faster 21:50 ireallyhateirc also probably what you've just said 21:57 MTDiscord i think it's just the former reason. or, sometimes, they do it out of necessity, because they are setting an environment via setfenv (a lesser known 5.1 feature) later, and need to "import" the globals they want to use. 21:58 ireallyhateirc by former you mean my reply, or gera's question? 21:58 ireallyhateirc https://dev.minetest.net/Lua_Optimization_Tips#Prefer_local_variables 22:05 MTDiscord Your reply. The main motivation behind this is usually optimization. 22:18 gera yeah thanks, ireallyhateirc 22:18 gera i found justification in gems book, page 17 22:35 MTDiscord A third reason for making a local copy of a var is for linting purposes. I used to only have syntax highlighting to work with, and didn't have a good way to put a linter into my workflow, so having all accesses of globals at the top made it easy to spot a stray one with syntax highlighting alone. 22:36 MTDiscord As an optimization it usually means nothing and rarely means something, but it usually costs me nothing to run the localizer tool on my code tree, so the cost is basically zero, so I don't need a lot of chance of gain to justify it.