Thread Tools Display Modes
Prev Previous Post   Next Post Next
02/11/20, 08:00 PM   #1
ensiferumviking
Join Date: Jun 2014
Posts: 5
trying to build table, getting 'attempt to index a nil value' error

I'm still getting used to the lua table/key conventions. Here's the code that's causing problems:

Code:
local toonName=GetUnitName("reticleover")
PlayerInfoLogger.fullList[toonName]={}
That second line causes the error. 'toonName' is successfully resolving to a string. Can I not use a string variable as an index? fullList should be initialized to an empty table:

Code:
PlayerInfoLogger.Default={
  fullList={}
}
function PlayerInfoLogger:Initialize()
  --Define Saved Variables
  self.savedVariables=ZO_SavedVars:NewAccountWide("PlayerInfoLoggerSavedVariables", 1, nil, {PlayerInfoLogger.Default})

  --If there's a saved value, use that.
  PlayerInfoLogger.fullList=self.savedVariables.fullList
end
Is there a way to check that 'fullList' is indeed getting intialized? I've been able to verify the the Initialize function does get called.

Here's the txt manifest file:
Code:
## Title: Genesis PlayerInfoLogger
## Author: |c999999Genesis1701d
## Version: 3.15
## Description: Logs basic information about the characters around you.
## APIVersion: 100028
## SavedVariables: PlayerInfoLoggerSavedVariables
  Reply With Quote
 

ESOUI » Developer Discussions » Lua/XML Help » trying to build table, getting 'attempt to index a nil value' error


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