Skip to content

FxFileID โ€‹

This module contains functions for creating and working with FileID lists.

Load โ€‹

lua
FxFileID = require "FxFileID";

Functions โ€‹

FunctionDescription
Count (FileType, FileID)Returns the number of items in a list.
Create (FileType, FileID)Creates a file list.
FilterCategory (FileType, FileID, Category)Filters files of given category from a file list.
FilterID (FileType, FileID, Value)Filters files from a file list.
Get (FileType, FileID, Index)Returns the file from a file list at given index.
Merge (FileType, FileID1, FileID2)Merges two file lists.
Remove (FileType, FileID, RemoveFileID)Removes a file from a list.
Reverse (FileType, FileID)Reverses a file list.
SortCategory (FileType, FileID)Sorts a file list by category.
SortDate (FileType, FileID)Sorts a file list by date.
SortID (FileType, FileID)Sorts a file list by ID.

Count (FileType, FileID) โ€‹

This function returns the number of files identified by the specified FileID and FileType.

Parameters โ€‹

  • FileType: The FileType to identify the files of the list
  • FileID: The FileID to identify the files of the list

Returns โ€‹

The number of identified files

Errors โ€‹

Possible errors include FX_TYPE_INVALID, FX_FILE_NOT_FOUND

Since โ€‹

Version 1.0

Example โ€‹

lua
val = FxFileID.Count(111, "<model1,model2,model3>");
-- returns 3

-- get number of selected assets
val = FxFileID.Count(111, "/s"); 

-- get number of cubemaps
val = FxFileID.Count(222, "*");

Create (FileType, FileID) โ€‹

This function returns a valid FileID list identified by the given FileID and FileType.

Parameters โ€‹

  • FileType: The FileType to identify the files of the list
  • FileID: The FileID to identify the files of the list

Returns โ€‹

A valid FileID list without duplicates

Errors โ€‹

Possible errors include FX_TYPE_INVALID, FX_FILE_NOT_FOUND

Since โ€‹

Version 1.0

Example โ€‹

lua
-- make a list of all cubemaps
list = FxFileID.Create(222, "*");

FilterCategory (FileType, FileID, Category) โ€‹

This function returns the items of FileID that match the given category.

Parameters โ€‹

  • FileType: The FileType to identify the files of the list
  • FileID: The FileID to identify the files of the list
  • Category: The Category to filter

Returns โ€‹

A valid FileID list without duplicates

Errors โ€‹

Possible errors include FX_TYPE_INVALID, FX_FILE_NOT_FOUND, FX_VALUE_INVALID

Since โ€‹

Version 1.0

Example โ€‹

lua
-- get list of assets that are categorized as bird
list = FxFileID.FilterCategory(111, "*", 33);

FilterID (FileType, FileID, Value) โ€‹

This function returns the items of FileID that have Value in their FileID.

Parameters โ€‹

  • FileType: The FileType to identify the files of the list
  • FileID: The FileID to identify the files of the list
  • Value: The filter string

Returns โ€‹

A valid FileID list without duplicates

Errors โ€‹

Possible errors include FX_TYPE_INVALID, FX_FILE_NOT_FOUND

Since โ€‹

Version 1.0

Example โ€‹

lua
list = FxFileID.FilterID(111, "<model1,bitmap2,movie1>", "mo");
-- returns "<model1,movie1>"

Get (FileType, FileID, Index) โ€‹

This function returns the items of FileID at given index. The index of the first item is 0.

Parameters โ€‹

  • FileType: The FileType to identify the files of the list
  • FileID: The FileID to identify the files of the list
  • Index: The list index

Returns โ€‹

A single FileID

Errors โ€‹

Possible errors include FX_TYPE_INVALID, FX_FILE_NOT_FOUND, FX_VALUE_INVALID

Since โ€‹

Version 1.0

Example โ€‹

lua
list = FxFileID.Get(111, "<dear,bear,fox", 2);
-- returns "fox"

Merge (FileType, FileID1, FileID2) โ€‹

This function merges FileID and AddFileID and returns the new list.

Parameters โ€‹

  • FileType: The FileType to identify the files of the list
  • FileID1: The FileID to identify the files of the list1
  • FileID2: The FileID to identify the files of the list2

Returns โ€‹

A valid FileID list without duplicates

Errors โ€‹

Possible errors include FX_TYPE_INVALID, FX_FILE_NOT_FOUND

Since โ€‹

Version 1.0

Example โ€‹

lua
list = FxFileID.Merge(111, "<model1,model2>", "model3");
-- returns "<model1,model2,model3>"

list = FxFileID.Merge(111, list, "<bitmap1,bitmap2>");
-- returns "<model1,model2,model3,bitmap1,bitmap2>"

Remove (FileType, FileID, RemoveID) โ€‹

This function takes the files identified by the given FileID and FileType, removes all files identified by the given RemoveID, and returns the new list.

Parameters โ€‹

  • FileType: The FileType to identify the files of the list
  • FileID: The FileID to identify the files of the list
  • RemoveFileID: The FileID to identify the files to remove from the list

Returns โ€‹

A valid FileID list without duplicates

Errors โ€‹

Possible errors include FX_TYPE_INVALID, FX_FILE_NOT_FOUND

Since โ€‹

Version 1.0

Example โ€‹

lua
list = "<bus,train,car>";
list = FxFileID.Remove(111, list, "car");
-- returns "<bus,train>"

Reverse (FileType, FileID) โ€‹

This function reverses the order of files identified by the given FileID and FileType and returns the new list.

Parameters โ€‹

  • FileType: The FileType to identify the files of the list
  • FileID: The FileID to identify the files of the list

Returns โ€‹

A valid FileID list without duplicates

Errors โ€‹

Possible errors include FX_TYPE_INVALID, FX_FILE_NOT_FOUND

Since โ€‹

Version 1.0

Example โ€‹

lua
list = "<one,two,three>";
list = FxFileID.Reverse(111, list);
-- returns "<three,two,one>"

SortCategory (FileType, FileID) โ€‹

This function takes the items of FileID and sorts them by their category.

Parameters โ€‹

  • FileType: The FileType to identify the files of the list
  • FileID: The FileID to identify the files of the list

Returns โ€‹

A valid FileID list without duplicates

Errors โ€‹

Possible errors include FX_TYPE_INVALID, FX_FILE_NOT_FOUND, FX_VALUE_INVALID

Since โ€‹

Version 1.0

Example โ€‹

lua
-- get list of assets sorted by category
list = FxFileID.SortCategory(111, "*");

SortDate (FileType, FileID) โ€‹

This function takes the items of FileID and sorts them by their date of last change starting with new newest file.

Parameters โ€‹

  • FileType: The FileType to identify the files of the list
  • FileID: The FileID to identify the files of the list

Returns โ€‹

A valid FileID list without duplicates

Errors โ€‹

Possible errors include FX_TYPE_INVALID, FX_FILE_NOT_FOUND

Since โ€‹

Version 1.0

Example โ€‹

lua
-- get list of assets sorted by date of last change
list = FxFileID.SortDate(111, "*");

SortID (FileType, FileID) โ€‹

This function takes the items of FileID and sorts them alphabetically.

Parameters โ€‹

  • FileType: The FileType to identify the files of the list
  • FileID: The FileID to identify the files of the list

Returns โ€‹

A valid FileID list without duplicates

Errors โ€‹

Possible errors include FX_TYPE_INVALID, FX_FILE_NOT_FOUND

Since โ€‹

Version 1.0

Example โ€‹

lua
list = "<fish,whale,shark>";
list = FxFileID.SortID(111, list);
-- returns "<fish,shark,whale>"