Thread Tools Display Modes
07/31/14, 10:38 PM   #1
Sk4lli
Join Date: Jul 2014
Posts: 3
newbie needs help with his addon

Hi my name is Sk4lli,
i'm completely new to Lua scripting and thought ESO is a great game so i could give it a try.

in my First addon i would gather information about the Player Character and save it to the "Saved Variables" but there is already the problem because it won't save the variables, i don't know where i have made a mistake.

Code:
user:/AddOns/CharHarvester/Charharvester.lua:62: attempt to index a nil value stack traceback
user:/AddOns/CharHarvester/Charharvester.lua:62: in function 'CH.MotifKnown'
EsoUI/Ingame/SlashCommands/SlashCommands.lua:108: in function 'DoCommand'
EsoUI/Ingame/ChatSystem/ChatSystem.lua:1849: infunction 'ChatSystem:SubmitTextEntry'
EsoUI/Ingame/ChatSystem/ChatSystem.lua:2682: in Function 'TO_ChatTextEntry_Execute'
14406795741938050902:3: infunction '(main chunk)'
(tail call):?

The Lua File:
Warning: Spoiler



i hope you guys can help me.

greetz Sk4lli
  Reply With Quote
07/31/14, 11:42 PM   #2
katkat42
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 155
You have a typo where you declare your "CH.defautls", er, "CH.defaults" variable.
  Reply With Quote
08/01/14, 12:10 AM   #3
Sk4lli
Join Date: Jul 2014
Posts: 3
seriously? a Typo? ^^ thanks mate

the "savedVars" file is generating now .. but the error still appears
  Reply With Quote
08/01/14, 06:34 AM   #4
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
- You are trying to get character information at the time when it is not available yet.
- It seems that you never call function CH.AssignMotifs() so the table CH.motifsList doesn't exists.
- Variable "addonName" in the CH.init function does not exist, name of argument you have defined is "addOnName".
- As katkat42 said, you have typo CH.defaults table name -> you have defined table "CH.defautls" and you are trying to use "CH.default".

Modified code:
Warning: Spoiler

Last edited by Garkin : 08/03/14 at 04:51 AM. Reason: corrected typo, changed to ipairs as suggested by merlight
  Reply With Quote
08/01/14, 11:41 AM   #5
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
Originally Posted by Sk4lli View Post
Lua Code:
  1. --
  2.     local m, i
  3.     for m = 1, 14 do
  4.         i = CH.motifsList[m]
Lua language corner for loop control variable is implicitly local to the loop, you don't have to declare it. Actually your 'local m' is a different variable, shadowed by the 'for m' inside the loop. And to further simplify iterating an array-like table, use ipairs:
Lua Code:
  1. -- used your names, but had to think twice, since conventionally 'i' is the index variable ;)
  2. for m, i in ipairs(CH.motifsList) do ...
  Reply With Quote
08/02/14, 02:30 AM   #6
Sk4lli
Join Date: Jul 2014
Posts: 3
@Garkin and merlight

thank you both, now I'm a big step further with my plan.

But it shows me I still have much to learn.


greetings Sk4lli
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » newbie needs help with his addon


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