Thread Tools Display Modes
10-26-18, 02:08 PM   #1
MuffinManKen
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 106
The the problem is in this line:
tempZone.User.args[worldcheck(dbd.useryell[i].w)].args[dbd.useryell[i].zone] = {

Which table index is nil? It's hard to know since there are roughly 10 different indexing operations in that 1 line. I would recommend cleaning that up so that it's more readable, easier to find issues, and also more efficient:
Lua Code:
  1. if(dbd.useryell[i]) then
  2.             if (not dbd.useryell[i].w) then dbd.useryell[i].w = "1" end
  3.             local wc = worldcheck(dbd.useryell[i].w)
  4.             local zone = dbd.useryell[i].zone
  5.             local world_args = tempZone.User.args[wc]
  6.             if(not world_args.args[zone]) then
  7.                 world_args.args[zone] = {
  8.                     type = 'group',
  9.                     name = zone,
  10.                     desc = zone,
  11.                     args = {},
  12.                 }
  13.             end

Without knowing the data, it's hard to pinpoint the problem but splitting that stuff up should help zero in on where the issue is. For example, if dbd.useryell[i].w is a value other than nil, "1", "2" then worldcheck() will return nil.

Efficiency-wise there is no need to call worldcheck over and over, so we assign the result to a variable and that can be re-used everywhere else in that loop.

Some of the variable names I used may not be ideal, so adjust as needed.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Lua Errors from Bosstalk


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