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; else result = num2; end return result; end -- 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 tolua.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: | https://npp-user-manual.org/docs/function-list/ | \=========================================================================== --> <NotepadPlus> <functionList> <parser displayName="Lua" id="lua_function" commentExpr="--.*?$" > <!-- Basic lua table view, nested lua table not supported --> <classRange mainExpr="[.\w]+[\s]*=[\s]*\{" openSymbole="\{" closeSymbole="\}" displayMode="node"> <className> <nameExpr expr="[.\w]+"/> </className> <function mainExpr="[.\w]+[\s]*=[\s]*['"]?[\w]+['"]?"> <functionName> <funcNameExpr expr=".*"/> </functionName> </function> </classRange> <!-- Basic lua functions support --> <function mainExpr="(function[\s]+[.\w]+(:[\w]+)?)|([.\w]+[\s]*=[\s]*function)" displayMode="$className->$functionName"> <functionName> <nameExpr expr="((?<=function)[\s]+[.:\w]+)|(([.\w]+)(?=([\s]*=[\s]*function)))"/> </functionName> <className> <nameExpr expr="[.\w]+(?=:)"/> </className> </function> </parser> </functionList> </NotepadPlus>Unlike the site says, you don’t need to check or change an
<association>tag or edit the newoverrideMap.xml, because Lua defaults tolua.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.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login