-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tf_util-bugfix #10
base: master
Are you sure you want to change the base?
tf_util-bugfix #10
Conversation
Related to #8 |
@@ -1,4 +1,4 @@ | |||
local util = require("util") | |||
local util = table.deepcopy ( require("util") ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I admit I am not very good with lua nor factorio modding, but does this not make a deepcopy only for the local
variable? Or does this actually carry over to the, let's say, script/construction_drone.lua
file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way tables work in Lua is that every variable with a table in it doesn't actually contain the table, it's merely a portal to the table. So every change made to it will apply to the original table, and every OTHER local variable that points at the same table as it will be able to see it. This is why you can do local belt = data.raw["transport-belt"]["express-transport-belt"]; belt.speed = 60
, and it would apply to the original object held in the data table.
In the example you provide with scripts/construction_drone.lua, it never actually did see the modified tf_util table, even before I touched anything, since tf_util is executed during the DATA stage, which the script file is used during the CONTROL stage. No data beyond what factorio takes from the data
table is transferred over.
The util
in that file is defined in control.lua line 3
.
I built these changes locally, but received errors when I ran other Klanon "based" mods. Running Hive_Mind_MitchPlay This is the error I receive on startup with Hive_Mind. I came back through this code base to change all "util" calls to local with deep_copy. Still receive the error on with Hive_mind, seems like there might be a deeper problem with Klanon "based" mods. |
No description provided.