[0.17.69] Can assign values to LuaRemote and possibly others

We are aware of them, but they have low priority. We have more important things to do. They go here in order not to take space in the main bug thread list.
Post Reply
Boodals
Fast Inserter
Fast Inserter
Posts: 129
Joined: Sun Feb 11, 2018 7:10 pm
Contact:

[0.17.69] Can assign values to LuaRemote and possibly others

Post by Boodals »

I just found that you can assign variables to LuaRemote and possibly others.

Code: Select all

/c remote.potato = 4 --no error
/c game.print(remote.potato) --prints 4

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

Re: [0.17.69] Can assign values to LuaRemote and possibly others

Post by Klonan »

So what does this break?

Boodals
Fast Inserter
Fast Inserter
Posts: 129
Joined: Sun Feb 11, 2018 7:10 pm
Contact:

Re: [0.17.69] Can assign values to LuaRemote and possibly others

Post by Boodals »

Klonan wrote:
Sun Sep 29, 2019 8:04 pm
So what does this break?
The rule that you cant modify LuaObjects other than their explicit properties? idk
You could ask the opposite question about LuaObjects that don't allow setting random variables.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13204
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.17.69] Can assign values to LuaRemote and possibly others

Post by Rseding91 »

Thanks for the report however there's no such rule; It's just "how it is." There are infrequently (if ever) rules/guidelines for anything in Factorio. Most everything is just "what ever the programmer thought sounded good on the day he wrote it". Back when Kovarex or Tomas started the Lua API they made it so trying to write to properties on LuaObjects that didn't exist threw an error instead of silently doing nothing. So, that's what it still does today.

Nobody ever explained why or thought that maybe another method would be better (silently doing nothing?) - everything just silently uses the same code that was written years ago.

Some of the Lua API has been implemented differently over the years as it needed to work differently than the basic "read/write values for a single lua context" and so diverged and didn't implement the same "error if someone tries to write when this doesn't support writing".

I don't consider it worth going over all of the Lua API and making it a rule that everything needs to follow this pattern because it's not going to add any value in the end and it's just going to generate more bug reports about other places where it might be missing, more commits to work on, more code, and in the end nothing will be different.

I would rather focus our collective efforts on things which actually improve the game: fixing crashes, fixing desycs, improving game performance, making new mods possible by adding new things to the mod API and so on.
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Minor issues”