Always add Filter, ExcludedTypes to script!
July 24, 2016 08:45PM
I had a request to modify one of my scripts, to limit it to specific sizes. The easiest way is to add the "Filter" parameter in the tag, allowing to filter on sizes, terrains, difficulty, etc. At that point even though I can't see any reason why anyone would want to use it, I am now adding filter to all of my checkers, and also excluded types. A side benefit is that country is now handled in the filter, so can be removed as such from the checker (edit tags to suit).

Unless the checker is written to handle one very specific challenge, I recommend that all checkers have Filter included, and, just to make it easier, also add ExcludedTypes. Even if none of the challenges you will be tagging require them.

And while I am there, I am also going through my checkers and removing any HTML in the copy and paste output.



Edited 1 time(s). Last edit at 07/24/2016 08:46PM by the Seagnoid. (view changes)
Re: Always add Filter, ExcludedTypes to script!
August 23, 2016 12:39PM
I agree, I usually do what you are saying like this:
local filter = {}
if conf.filter ~= nil then
filter = conf.filter
end

and then I use that local filter variable when I call upon GetFinds()

Example script: http://project-gc.com/Challenges//22344?edit&scriptId=1447
(funny the script has id 1447, considering my alias)
Re: Always add Filter, ExcludedTypes to script!
November 29, 2016 12:22AM
You can do directly
PGC_GetFinds(profileId, { fields = fields, order = 'OLDESTFIRST', filter = conf.filter })
When the conf.filter is not defined, it's nil and nil is legal value to be passed to filter. Passing nil value is exactly the same as not define it.
However, when you want use conf.filter as table and you must be sure that it exists (i.e. for IPairs), you can do
IPairs(conf.filter or {})
Sorry, you do not have permission to post/reply in this forum.