function list not working for lua script

  • I’ve already tried adding new code into the function .xml file, but it doesn’t seem to be working, this code btw. Even basic functions don’t show up on the list:

    function max(num1, num2)
       if (num1 > num2) then
          result = num1;
          result = num2;
       return result; 
    -- calling a function
    print("The maximum of the two numbers is ",max(10,4))
    print("The maximum of the two numbers is ",max(5,6))

    I also already tried updating, and using portable versions, but nothing. Am I doing something wrong here?

  • @Kesler-Sullyvan said in function list not working for lua script:

    I also already tried updating, and using portable versions, but nothing.

    That’s because the instructions at that site were written for v7.9.0 and earlier; v7.9.1 and newer separate out each functionList configuration into a separate file.

    In your installed Notepad++, go to %AppData%\Notepad++\functionList\ folder 🛈, and copy one of the other language XML files to lua.xml. Replace the <parser ...> section with the <parser ...> from that other site: it will look like:

    <?xml version="1.0" encoding="UTF-8" ?>
    <!-- ==========================================================================\
    |   To learn how to make your own language parser, please check the following
    |   link:
    \=========================================================================== -->
            <parser displayName="Lua" id="lua_function" commentExpr="--.*?$" >
                <!-- Basic lua table view, nested lua table not supported -->
                        <nameExpr expr="[.\w]+"/>
                            <funcNameExpr expr=".*"/>
                <!-- Basic lua functions support -->
                        <nameExpr expr="((?<=function)[\s]+[.:\w]+)|(([.\w]+)(?=([\s]*=[\s]*function)))"/>
                        <nameExpr expr="[.\w]+(?=:)"/>

    Unlike the site says, you don’t need to check or change an <association> tag or edit the new overrideMap.xml, because Lua defaults to lua.xml.
    Exit Notepad++ and restart. The source code you showed will then show functions


  • Oh wow! Thanks so much! I still don’t know what worked, but as soon as I dropped your code into the functionlist folder, it clicked. Honestly, I don’t really code at all. I messed around with bots a while ago, but nowadays I just really enjoying organizing my texts using Lua on N++. I’m glad I posted, you made my day :)

  • @PeterJones Your code helped me too.

Log in to reply