Being my first ever public module, I’d like to ensure I am doing this all correct so excuse my brevity.
This module is nowhere near amazing and nearly as optimized as it can be, however it was a fun project I did and is somewhat useful in most of my projects.
You can retrieve the module here and place it anywhere.
Functions
module:Register()
- This function sets up the search engine with all the necessary variables and constants it needs.
module:ListCreate()
- This function sets up your UI based stuff, creating items (frames/textbuttons) for each of the instances within a storage folder.
module.SearchEngine()
- The main function, returns results of a inputted text from your searchboxes.
Arguments
The module:Register()
function requires four arguments, which are in detail below;
-
searchBox: TextButton
- The primary searchbox within the search engine. -
itemsStorage: any
- Anything with children inside of it which can show up for results (i.e a tools folder in serverstorage) -
scrollingFrame: ScrollingFrame
- The main UI part which will store all of the results (i.e a catalog) -
buttonTemplate: any
- This is the template that the script will clone for each result it finds within the itemsStorage folder.
Setup
- Require your module using
require()
- Run
module:Register(arguments)
, passing through the correct arguments - Run
module:ListCreate
to initialise the list of items. - That’s it!
Please feel free to leave comments, reviews and suggestions below!
v1