Skip to content
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

Undeclared global variable "composter_on_metadata_inventory_move" generates WARNING #17

Open
npalix opened this issue May 26, 2020 · 4 comments

Comments

@npalix
Copy link

npalix commented May 26, 2020

https://github.com/JBBgameich/agriculture/blob/96d48538ea95dce131556f792368b543f4f6dc4c/compost/init.lua#L300

WARNING[Main]: Undeclared global variable "composter_on_metadata_inventory_move" accessed at [...]/mods/agriculture/compost/init.lua:300

@jbruechert
Copy link
Owner

@lnjX Could you look into this please?

@npalix
Copy link
Author

npalix commented May 27, 2020

There is also the same thing with the following line.
Undeclared global variable "gardens" accessed at [...]/mods/agriculture/gardens/init.lua:11

@jakimfett
Copy link

jakimfett commented Oct 31, 2020

Am seeing this as well.

It looks like there's a missing function, composter_on_metadata_inventory_move, and there's two similarly titled functions already in the file. Both functions log the action, and they both trigger the same composter_update_state function, see lines #252 & #262 respectively.

I was able to find the use of the same assignment (on_metadata_inventory_move = something) in the protectors mod, so with those datapoints I've attempted a cobbled together a fix for this that...seems to work, though I'm still testing it on my dev server.

WARNING: am reasonably certain there's more this function was intended to do...the compost bin probably isn't going to work correctly.

local function composter_on_metadata_inventory_move(pos, from_list, from_index, to_list, to_index, count, player)
	core.log("action", player:get_player_name() .. " takes moves stuff incompost bin at " .. core.pos_to_string(pos))
	local meta = core.get_meta(pos)
	composter_update_state(pos, meta, meta:get_inventory())
end

Sharing my progress so others can test it too, and I'll add a proper pull request once I finish tinkering.

Analysis of the rest of the mod would be necessary to determine if moving things inside the compost bin inventory should do anything, and really the only person who can answer this is the original author of this file, if the answer exists at all.

jakimfett added a commit to jakimfett/agriculture that referenced this issue Oct 31, 2020
Error is due to gardens attempting to use the existing gardens object.
Error can be safely ignored.
@jakimfett
Copy link

@npalix the gardens one is working as intended, per my best guess about the code.

See this commit for the bits I've added to contextualize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants