1. IMPORTANT:
    We launched a new online community and this space is now closed. This community will be available as a read-only resources until further notice.
    JOIN US HERE

How to find out count of items in .nka file

Discussion in 'Scripting Workshop' started by franto, Jul 29, 2019.

  1. franto

    franto NI Product Owner

    Messages:
    43
    Hey, I'm using a lot of .nka files with load_array_str and save_array_str, but I'm not aware of any good way how to find the length of items in .nka files. Maybe it's simple, but I don't know how.

    For numbers: check where the "0" starts pop up as value, but 0 can be normal value and not just non-existing line
    For string: checking empty string with "find_group workaround"

    I hope there is a better solution...
     
  2. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    End your NKA with some odd number that doesn't get used normally (like -1234567890) then search the array for it.
     
  3. franto

    franto NI Product Owner

    Messages:
    43
    ok, makes sense, what about string arrays?
     
  4. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Probably best to have another array with just a single entry that tells how many entries in the string array are used.

    On the other hand... why don't you make your NKAs have a fixed size so that you always know their size?
     
  5. franto

    franto NI Product Owner

    Messages:
    43
    yes, that's what I had in my mind... different array for total sizes. Some of my NKA are fixed size, but some are dynamic because I'm using it for saving Browser presets, which can be created and saved by the user.