-
Notifications
You must be signed in to change notification settings - Fork 0
SelectJSONList
StackZ edited this page Jun 17, 2021
·
1 revision
UniversalEdit.SelectJSONList(Message, JSONFile);
This function expects 2 parameters.
- Message: The message to display of what should be selected.
- JSONFile: The path to a JSON file, see a bit below for how it should be structured.
The JSON file should be structured like this:
{
"Red": 0,
"Green": 1,
"Blue": 3
}
The key, such as "Red"
is basically what is displayed in the list, and the value, in that case 0
would be the index, which would be returned when the user selects it.
-- Let the user select between colors from a JSON file (The JSON is called 'Colors.json' and has the structure as above).
local Selection = UniversalEdit.SelectJSONList("Select a color.", "sdmc:/3ds/Universal-Edit/Hex-Editor/Scripts/Colors.json");
-- Here is a proper checking example of the input.
if (Selection == 0) then -- Selected Red.
-- Do something with red.
elseif (Selection == 1) then -- Selected Green.
-- Do something with green.
elseif (Selection == 3) then -- Selected Blue.
-- Do something with blue.
else -- That'd be everything that is NOT 0, 1 or 3. If the user cancelled the selection, it returns -1, so keep that in mind!
-- Cancel or something.
end