Thread Tools Display Modes
01/04/24, 08:31 PM   #1
robert.labrie
AddOn Author - Click to view addons
Join Date: Dec 2021
Posts: 16
using GetJounalQuestInfo()

I'm trying to get where I am in a given quest flow via activeStepText from GetJournalQuestInfo


Code:
     local count = GetNumJournalQuests()
     for i = 1, count do
        local name = GetJournalQuestName(i)
        local questName, backgroundText, activeStepText, activeStepType, activeStepTrackerOverrideText, completed, tracked, questLevel, pushed, questType,_ = GetJounalQuestInfo(i)
        -- do other relevant stuff here
     end
It keeps throwing "function expected instead of nil"

I won't pretend to be a Lua expert but I don't see any blatant syntax errors any help would be welome
  Reply With Quote
01/04/24, 11:21 PM   #2
Dolgubon
 
Dolgubon's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2016
Posts: 409
So, in debugging something that gives an error like that, the first thing to check is what line/piece of code is causing the issue.
You haven't provided line numbers, but the error originates from line 4 of your code snippet. So you can drill down on that particular line.
Looking at the error again, it says 'function expected instead of nil.' Or, in other words, you tried to call a function, but the function was did not exist (nil being similar to null)

So you are trying to call a function that does not exist on line 4, so it's a good idea to then check the functions used on that line closely. If you do /script d(GetJounalQuestInfo) you'll see that the output is nil! Compare that to /script d(GetNumJournalQuests) where you get something like function: 0000012BB24BF7E0.

Now at this point, if you look veeeeery closely, letter by letter, at the function you're calling, you might see the problem.
GetJounalQuestInfo

In this case it was a simple typo, but in cases where it isn't a typo, double checking https://wiki.esoui.com/API for the function name, or maybe inspecting the table (if the function you're trying to call is on a table) using /zgoo or torchbug can help you to find out why a function you're trying to call is nil. For reference, I had to look at the API page for the actual function name before I noticed it was a typo
  Reply With Quote
01/05/24, 03:52 AM   #3
robert.labrie
AddOn Author - Click to view addons
Join Date: Dec 2021
Posts: 16
I swear I copied it from the API page too. Thanks Dolgubon. The rest of the code actually invokes LibLazyCrafting (I'm automating the certification stuff) so thanks for that too.

Cheers,
Robert
  Reply With Quote
01/05/24, 04:47 AM   #4
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,989
Hint:

https://wiki.esoui.com/API
!!!Is outdated (as the top lines of that wiki page tells you too) so please always have a look at the proper ESOUI documentation txt files instead which are linked at the Wiki's ESOUI version history!!!

https://wiki.esoui.com/APIVersion
-> live API version
--->
  Reply With Quote
01/05/24, 08:52 AM   #5
robert.labrie
AddOn Author - Click to view addons
Join Date: Dec 2021
Posts: 16
Got it, thanks everyone.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » using GetJounalQuestInfo()


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off