[0.17.79] util table inside util.lua is global

Bugs that are actually features.
Post Reply
asdff45
Long Handed Inserter
Long Handed Inserter
Posts: 62
Joined: Sun Aug 07, 2016 1:23 pm
Contact:

[0.17.79] util table inside util.lua is global

Post 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.

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5150
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

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

Post by Klonan »

Its fine, its mostly to not break backwards compatibility in a lot of cases, and to allow different styles of coding it

Post Reply

Return to “Not a bug”