Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10278


Ignore:
Timestamp:
Feb 18, 2015, 9:56:38 PM (9 years ago)
Author:
landauf
Message:

fixed issue with inline-lua-code. only add an extra space if there's actually a line-break at the beginning of the text-content. otherwise code like this: mesh="ast<?lua print(1) ?>.mesh" becomes mesh="ast1 .mesh" instead of mesh="ast1.mesh"

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/libraries/core/Loader.cc

    r10273 r10278  
    470470                    //A newline directly after square brackets is ignored. To make sure that the string is printed
    471471                    //exactly as it is, including newlines at the beginning, insert a space after the brackets.
    472                     output << "print([" + equalSigns + "[ " + temp + ']' + equalSigns +"])";
     472                    bool needsExtraSpace = false;
     473                    if (temp.size() > 0 && (temp[0] == '\n' || temp[0] == '\r')) // begins with \n or \r (a line break)
     474                        needsExtraSpace = true;
     475                    output << "print([" + equalSigns + (needsExtraSpace ? "[ " : "[") + temp + ']' + equalSigns +"])";
    473476                    start = end + 5;
    474477                }
Note: See TracChangeset for help on using the changeset viewer.