BitMaskToString(string) takes a string and returns NF and an IndexList. NF is equal to the number of '0' and '1' characters in the string. IndexList is a table containing the positions of the '1's only counting '1's and '0's.
See also IndexToBitMask
BitMask = "00000 10101 000" NF, Index = BitMaskToIndex(BitMask) print(NF) print(Index)
12 {5,7,9}