Hemiptera Bugtracker at bugs.linux-forks.de

advtrains

Undeclared globals

Send replies to 176@bugs.linux-forks.de or using the Form below.
avatar From: OP
Sat, 27 Mar 2021 19:32:01 -0000

Using the master branch, at commit 5d372b1c. Running under Minetest 5.4.0 with Dreambuilder game. Other trains mods installed: basic_trains, disco_trains, minetest-moretrains

There a number of complaints from Minetest of undeclared globals.

Normally *all* variables and such in Lua should either be declared local to limit their scope, or be part of a unique namespace, such as an entry in a global table named for the mod.

Otherwise if two unrelated mods use the same global variable name, they will conflict, probably corrupting each others' states.

Here's what's shown up in my log so far:

```

2021-03-26 08:06:28: WARNING[Main]: Undeclared global variable "intllib" accessed at ...dmods/advtrains_modpack/advtrains_luaautomation/init.lua:6

2021-03-26 08:23:40: WARNING[Server]: Assignment to undeclared global "linhei" inside a function at ...e_World/worldmods/advtrains_modpack/advtrains/wagons.lua:946.

2021-03-26 08:25:48: WARNING[Server]: Assignment to undeclared global "s" inside a function at ...ld/worldmods/advtrains_modpack/advtrains/trackplacer.lua:292.

2021-03-26 08:31:44: WARNING[Server]: Assignment to undeclared global "dir" inside a function at ...ilder_game/mods/infrastructure/advanced_boom_barrier.lua:7.

2021-03-26 10:56:59: WARNING[Server]: Undeclared global variable "t" accessed at ...e_World/worldmods/advtrains_modpack/advtrains/couple.lua:152

2021-03-26 13:14:30: WARNING[Server]: Undeclared global variable "newstate" accessed at ...e_World/worldmods/advtrains_modpack/advtrains/tracks.lua:527

2021-03-26 13:23:24: WARNING[Server]: Undeclared global variable "id" accessed at ...rld/worldmods/advtrains_modpack/advtrains/trainlogic.lua:143

2021-03-26 13:30:11: WARNING[Server]: Assignment to undeclared global "dirvec" inside a function at ...e_World/worldmods/advtrains_modpack/advtrains/tracks.lua:670.

```

--

"There are some things in life worth obsessing over.  Most

things aren't, and when you learn that, life improves."

Vanessa Dannenberg <vanessa.e.dannenberg@gmail.com>

avatar From: Developer
Sun, 25 Apr 2021 19:57:01 -0000

Thanks for reporting. I've fixed these warnings.

avatar Status Update
Sun, 25 Apr 2021 20:03:01 -0000
This bug was closed.
Reply