ID:1764039
 
Keywords: database, search
(See the best response by Zecronious.)
How would I create a searchable database?

For example, a number of items would be added to a list created at runtime.

I would like to implement it into the interface so when the search_database() verb is called it would output the results of which items from the list include the text from the input.

Not sure where to start looking.
What do you want to store in the database? Also, do you want to store it in a text file?
I want to store objects in the list that output as their image file. Then I would make a save system for the list.
Best response
This is how I would do it. Database is a list which you can add() and remove() things from. When you do, it automatically saves an updated copy of itself.

To make a new database you give it a file name.

var/Database/myDatabase = new/Database("Database")


If a file already exists with that name then the new database object will read the file and turn itself into that database.

Database
parent_type = /datum

var/list/contents = list()
var/filename

New(FILENAME)
filename = FILENAME
if(!fexists(filename)) save()
else load()

proc
add(thing)
contents += thing
save()

remove(thing)
contents -= thing
save()

search(element)

save()
Write(new/savefile(filename))

load()
Read(new/savefile(filename))
I highly recommend using the /database system that BYOND provides. It uses SQLite (you can Google SQLite syntax) to store data in a very robust format that includes powerful search systems.
I'm not really sure on how the sq lite database works tbh. Looks a bit more challenging. How would I output something from the database as it's icon.