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

Seablock: foremanexport/instrument-control.lua:442: bad argument #1 of 2 to 'pairs' (table expected, got nil) #40

Closed
Knofbath opened this issue Jul 22, 2022 · 4 comments

Comments

@Knofbath
Copy link

Using SeaBlockMetaPack 1.1.3:

0.000 Error Util.cpp:83: The scenario level caused a non-recoverable error.
Please report this error to the scenario author.

Error while running event level::on_nth_tick(1)
__foremanexport__/instrument-control.lua:442: bad argument #1 of 2 to 'pairs' (table expected, got nil)
stack traceback:
	[C]: in function 'pairs'
	__foremanexport__/instrument-control.lua:442: in function 'ExportResources'
	__foremanexport__/instrument-control.lua:514: in function <__foremanexport__/instrument-control.lua:499>

Workaround by deleting function :442 in \foremanexport_1.0.0\instrument-control - nn.lua:

	for _, product in pairs(resource.mineable_properties.products) do
		tproduct = {}
		tproduct['name'] = product.name
		tproduct['type'] = product.type

		amount = (product.amount == nil) and ((product.amount_max + product.amount_min)/2) or product.amount
		amount = amount * ( (product.probability == nil) and 1 or product.probability)
		tproduct['amount'] = amount

		if product.type == 'fluid' and product.temperate ~= nil then
			tproduct['temperature'] = ProcessTemperature(product.temperature)
		end
		table.insert(tresource['products'], tproduct)
	end
gillett-hernandez added a commit to gillett-hernandez/Foreman2 that referenced this issue Sep 24, 2022
@mrozpara
Copy link

it's better to add:
if resource.mineable_properties.products ~= nil then
...
end

@gillett-hernandez
Copy link

@Knofbath i have this issue fixed in my fork, along with a public release (v2.1.3). feel free to use that if you don't want to build the repo and patch it yourself.

@Knofbath
Copy link
Author

@gillett-hernandez I had noticed your fix a while back, don't even need to build the repo, just pulling that .lua file out of it and replacing the existing one was good enough.

@DanielKote
Copy link
Owner

Will be fixed in latest version

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

4 participants