This may be a stupid question, but I haven't been able to find the difference clearly outlined in the GAS documentation, and I was wondering what is qualified as a script vs a custom function. I have a Google Sheet that requires a function to run on an edit that checks whether the values entered already exist on another page (many line items are entered at once with a copy/paste and currently the script goes line by line to determine if a unique identifier from each line already exists on one of two other sheets, deleting any duplicates as it goes). I call this function from onEdit(), and on average it seems to take 30-40 seconds to run.
This is where I run into my problem, as the time limit for a custom function to run is 30 seconds, whereas scripts can run for 5 minutes. I should plan for my data set to grow, and therefore need this process to run as a script so that it doesn't cut off halfway through. I thought that onEdit() and anything you call from it qualified as a script and not a custom function, but clearly this is not the case. How do you make a script vs a function?
EDIT: Not sure why, but creating a manual trigger that calls onEdit on an edit seems to run it as a script, whereas the implicit onEdit call that is built in is called as a custom function. This fixed my immediate problem, but if anyone has an explanation of the difference I would still greatly appreciate it!