User Tag List

Page 4 of 5 FirstFirst ... 2 3 4 5 LastLast
Results 31 to 40 of 44

Thread: INI ++ 1.5

  1. #31
    Clicker Multimedia Fusion 2 Developer
    Jax's Avatar
    Join Date
    Jul 2006
    Location
    UK
    Posts
    702
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    You need to change "\\n" to "$". i.e. change the second line to:

    return "`" .. x .. y:gsub("`","$") .. "`"

    Is that what you mean?

  2. #32
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    CruddyBuddy's Avatar
    Join Date
    May 2010
    Posts
    158
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Well I figured that part out, but I was trying to make it so I could have something directly following the "=" because right now it only works if I do this:

    item=
    string1
    string2
    string3

    And not if I do this:

    item=string1
    string2
    string3

    I'm trying to end up with an output like this
    item=string1$string2$string3

    Quote Originally Posted by Jax View Post
    You need to change "\\n" to "$". i.e. change the second line to:

    return "`" .. x .. y:gsub("`","$") .. "`"

    Is that what you mean?

  3. #33
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    CruddyBuddy's Avatar
    Join Date
    May 2010
    Posts
    158
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I guess it's my fault because in my original example I had:
    item=
    this
    is
    a
    string

    But the way my scripting works if the first string following the "=" is like a command, with the following strings after each delimiter acting as parameters, so I'm trying to format things like this:

    [group]
    item=command
    _____parameter1
    _____parameter2
    _____parameter3

    And have it come out like this:

    item=command$parameter1$parameter2$parameter3

  4. #34
    Clicker Multimedia Fusion 2 Developer
    Jax's Avatar
    Join Date
    Jul 2006
    Location
    UK
    Posts
    702
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by CruddyBuddy View Post
    Well I figured that part out, but I was trying to make it so I could have something directly following the "=" because right now it only works if I do this:

    item=
    string1
    string2
    string3

    And not if I do this:

    item=string1
    string2
    string3

    I'm trying to end up with an output like this
    item=string1$string2$string3
    Ah sorry I didn't get what you meant!

    Perhaps try this:

    function helper(x,y)
    return x .. y:gsub("\n","$") .. "\n"
    end
    function fix(a)
    local b="\n" .. a:gsub("\r?\n","\n") .. "\n"
    return b:gsub("([^=\n]+%=)([^=%[]*)\n",helper):gsub("\n","\r\n")
    end


    I haven't had a chance to really test it, but that should allow multi-line entries which don't start on an empty line. I thought that was part of your desired format, sorry! I also changed it a little bit more so it doesn't use backticks anymore, which I thought was to get around some special behaviour in gsub and newlines, but apparently I just imagined that.

    I should note that multiline entries cannot have a left-square bracket ("[") in them. If that's a problem there might be some ways around it, but hopefully it isn't such a big issue.

  5. #35
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    CruddyBuddy's Avatar
    Join Date
    May 2010
    Posts
    158
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Thank you again, for your help.

    It looks like it DOES allow multiline entries like this:
    line=
    command
    string1
    string2
    etc

    But it doesn't automatically remove the TABs, so I end up with this: line=command$_____string1$_____string2 if I have TABs in my original ini.

    As I mentioned before, I'm using _____ to represent TABs here in the forum

    Quote Originally Posted by Jax View Post
    Ah sorry I didn't get what you meant!

    Perhaps try this:

    function helper(x,y)
    return x .. y:gsub("\n","$") .. "\n"
    end
    function fix(a)
    local b="\n" .. a:gsub("\r?\n","\n") .. "\n"
    return b:gsub("([^=\n]+%=)([^=%[]*)\n",helper):gsub("\n","\r\n")
    end


    I haven't had a chance to really test it, but that should allow multi-line entries which don't start on an empty line. I thought that was part of your desired format, sorry! I also changed it a little bit more so it doesn't use backticks anymore, which I thought was to get around some special behaviour in gsub and newlines, but apparently I just imagined that.

    I should note that multiline entries cannot have a left-square bracket ("[") in them. If that's a problem there might be some ways around it, but hopefully it isn't such a big issue.

  6. #36
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)Firefly 3D Module (Steam)
    Phi's Avatar
    Join Date
    Jan 2010
    Location
    England
    Posts
    1,912
    Mentioned
    22 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by CruddyBuddy View Post
    But it doesn't automatically remove the TABs
    The "tab" character is indicated in Lua and most other languages by "\t", which I don't see in the code you quoted. I don't know Lua, but
    Code:
    function helper(x,y)
    return x .. y:gsub("\n","$") .. "\n"
    end
    function fix(a)
    local b="\n" .. a:gsub("\r?\n","\n") .. "\n"
    return b:gsub("([^=\n]+%=)([^=%[]*)\n",helper):gsub("\t+",""):gsub("\n","\r\n")
    end
    may work for you. Substitutes (replaces) "\t+" into empty text, where \t is tab, and + indicates the previous thing must occur 1 or more times, so will replace \t, \t\t, \t\t\t... with empty text. You can see gsub patterns explained here.

  7. #37
    Clicker Multimedia Fusion 2 Developer
    Jax's Avatar
    Join Date
    Jul 2006
    Location
    UK
    Posts
    702
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I continued the conversation via PM to stop spamming this thread too much, but that's not dissimilar to the way went for (except I put it in helper in the form ^\t* so that it was only indent lines, but I doubt there is any practical distance)

  8. #38
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)Firefly 3D Module (Steam)
    Phi's Avatar
    Join Date
    Jan 2010
    Location
    England
    Posts
    1,912
    Mentioned
    22 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Jax View Post
    I continued the conversation via PM to stop spamming this thread too much, but that's not dissimilar to the way went for (except I put it in helper in the form ^\t* so that it was only indent lines, but I doubt there is any practical distance)
    Yea, I keep answering problems already answered today...
    Was there a reason Ini++1.5 doesn't support Unicode? I could help port it if there's no practical reason like an incompatible static library.

  9. #39
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    CruddyBuddy's Avatar
    Join Date
    May 2010
    Posts
    158
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Thank you for responding and for explaining how some of it works! I got used to being able to use tabs for formatting code in other scripts and then realized my ini files would be much easier to read if I could do the same.

    Quote Originally Posted by Phi View Post
    The "tab" character is indicated in Lua and most other languages by "\t", which I don't see in the code you quoted. I don't know Lua, but
    Code:
    function helper(x,y)
    return x .. y:gsub("\n","$") .. "\n"
    end
    function fix(a)
    local b="\n" .. a:gsub("\r?\n","\n") .. "\n"
    return b:gsub("([^=\n]+%=)([^=%[]*)\n",helper):gsub("\t+",""):gsub("\n","\r\n")
    end
    may work for you. Substitutes (replaces) "\t+" into empty text, where \t is tab, and + indicates the previous thing must occur 1 or more times, so will replace \t, \t\t, \t\t\t... with empty text. You can see gsub patterns explained here.

  10. #40
    Clicker Multimedia Fusion 2 Developer
    Jax's Avatar
    Join Date
    Jul 2006
    Location
    UK
    Posts
    702
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    The reason was just that Unicode MMF didn't exist at the time I wrote it! You are free to convert it - you can get the latest code off Clickteam, I think Yves has it - but beware! I wrote it when I was about 15. It is not good!

    (The chart object being written before HWA was a bigger disappointment, as it doesn't work at all now, and I thought it was pretty cool)

Page 4 of 5 FirstFirst ... 2 3 4 5 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •