As a Roblox developer, prompting users to input big files is currently over-complicated.
For the past few weeks I’ve been working on a plugin that imports Valve Map Files into Roblox, and currently the only way I can prompt the user to input the file is to open a script, and tell them to paste the file into the script:
Because these files can be several hundred thousand lines long, doing it like this tends to give the script editor a heart attack while it tries to syntax highlight the file:
Try to add binary files into the mix and… well, it gets a bit messy.
Roblox’s script editor “can” read it, but it REALLY does not enjoy trying to syntax highlight binary files. It takes almost 30 seconds for this script to be opened when double clicking it from the explorer!
This YieldFunction would prompt the user to open a file with the specified filters.
The filter parameter would work like the Filter property found in the FileDialog class from the .NET framework:
Although the use cases for this might seem a bit slim, I think this would open the door to a wide variety of neat applications for plugins.
This would be incredibly useful for my height-map plugin as well. I was able to get it working alright using global tables and some java code, but it would be preferable to be able to prompt specific files instead.
The first returned value would be a boolean describing the success of the call. If an error occurs while trying to read the file, or the user exits the window without selecting anything, this would be false.
The second returned value would be a string either containing the contents of the file if it succeeded, or an error message indicating why the call wasn’t successful (maybe a blank string or nil if the user just cancelled it, so the plugin could properly distinguish when an actual error occurred or not).