Jump to: Board index » General » Fusion

(SOLVED) FilterString in LUA

Learn about 3D compositing, animation, broadcast design and VFX workflows.
  • Author
  • Message
Offline
User avatar

Mikhail Korovyansky

  • Posts: 140
  • Joined: Mon Nov 10, 2014 9:59 pm

(SOLVED) FilterString in LUA

PostWed Jun 03, 2015 6:28 pm

Hey!

Is there something like "filterstring"? I want to filter string value by something..

For example, I have:
string = C:\myFolder\mySubFolder\myFile
I want to filter it by "\" to get
string[1] = C:
string[2] = myFolder
string[3] = mySubFolder
string[4] = myFile

In case when I need just to replace one to another I can use string.gsub(string, "initial", "new") all will works fine, but if I will need to add to the path or rearrange it I need to get it filtered.

Thanks!
Last edited by Mikhail Korovyansky on Thu Jun 04, 2015 11:56 am, edited 1 time in total.
Offline
User avatar

michael vorberg

  • Posts: 943
  • Joined: Wed Nov 12, 2014 8:47 pm
  • Location: stuttgart, germany

Re: FilterString in LUA

PostWed Jun 03, 2015 11:06 pm

eyeon had build a script lib that comes with every version of fusion which has a function called eyeon.split(input string, delimit). this functions returns a table with the sub parts of the input string

you can find it here and see also the comments for this function:
..\Program Files\Blackmagic Design\Fusion\Scripts\eyeon.scriptlib

the script lib has also a function "parseFilename" which sounds also helpful for you:
------------------------------------------------------------------------------
-- parseFilename()
--
-- this is a great function for ripping a filepath into little bits
-- returns a table with the following
--
-- FullPath : The raw, original path sent to the function
-- Path : The path, without filename
-- FullName : The name of the clip w\ extension
-- Name : The name without extension
-- CleanName: The name of the clip, without extension or sequence
-- SNum : The original sequence string, or "" if no sequence
-- Number : The sequence as a numeric value, or nil if no sequence
-- Extension: The raw extension of the clip
-- Padding : Amount of padding in the sequence, or nil if no sequence
-- UNC : A true or false value indicating whether the path is a UNC path or not
------------------------------------------------------------------------------
Offline
User avatar

Mikhail Korovyansky

  • Posts: 140
  • Joined: Mon Nov 10, 2014 9:59 pm

Re: FilterString in LUA

PostThu Jun 04, 2015 11:53 am

yeah, I know about parseFilename, but it not do full filtering right to harddrive..

but, eyeon.split did a great job! Thanks a lot!
Attachments
eyeon.split.jpg
eyeon.split.jpg (19.45 KiB) Viewed 1214 times

Return to Fusion

Who is online

Users browsing this forum: No registered users and 79 guests