What does surface.find_entities_filtered return if it didn't find anything? I'm trying to check if a search area contains any entities of type="resource", and checking if the returned table ~= nil didn't work.
Please let me know if there's more info I can add. I've attached the mod, sorry if it seems messy. The place I'm having trouble with is around line 74 of the control.lua.
*Edit: Added [Solved] to subject.*
[Solved] Need help with surface.find_entities_filtered
[Solved] Need help with surface.find_entities_filtered
- Attachments
-
- Resource_Relocation_Machine_0.0.1.zip
- (32.74 KiB) Downloaded 56 times
Last edited by Mengmoshu on Sun Apr 10, 2016 3:36 am, edited 1 time in total.
Re: Need help with surface.find_entities_filtered
It seems to return an empty table.
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!
Re: Need help with surface.find_entities_filtered
Thanks. Your info and a quick google search solved my problem I'm now doing something like:
I got the advice here: http://stackoverflow.com/questions/1252 ... no-entries
That was the last piece of code that needed to work to make the one feature of my mod. I might post in the WIP forum with what I've got, even though it's ugly in so many ways.
Edit: (This is solved, can I change the thread title to add [solved] to it?)
Code: Select all
if next(myTable) == nil then
-- myTable is empty
end
That was the last piece of code that needed to work to make the one feature of my mod. I might post in the WIP forum with what I've got, even though it's ugly in so many ways.
Edit: (This is solved, can I change the thread title to add [solved] to it?)