Page 1 of 1

[0.17.79] util table inside util.lua is global

Posted: Wed Jan 08, 2020 1:59 am
by asdff45
inside the `util.lua` file, the `util` table is defined global and later on returned to use in the files, where it is required from. For me, that makes no sence, it should be either a local table or not getting returned.

Every other file in the lualib has local tables, that getting returned. Or dont have a return, so the global variables can be used :)

Table definition: (line 1-4)

Code: Select all

util =
{
  table = {}
}
Return of the table (lane 427)

Code: Select all

return util
Edit: `mod-gui.lua`, `production-score.lua` and `silo-script` also have a return and global tables, where everything is defined. And most others, have the variables local and return them. It is no big issue, but a weird inconsistency.

Re: [0.17.79] util table inside util.lua is global

Posted: Wed Jan 08, 2020 9:42 am
by Klonan
Its fine, its mostly to not break backwards compatibility in a lot of cases, and to allow different styles of coding it