DevTool

DevTool

124 Downloads

[BUG] bad argument #1 to 'insert'

Sammers21 opened this issue ยท 1 comments

commented
3x DevTool/DevTool.lua:229: bad argument #1 to 'insert' (table expected, got nil)
[string "=[C]"]: in function `insert'
[string "@DevTool/DevTool.lua"]:229: in function `AddData'
[string "@sArena_Updated2_by_sammers/sArena.lua"]:273: in function <sArena_Updated2_by_sammers/sArena.lua:270>

Locals:
(*temporary) = nil
(*temporary) = <table> {
 value = "arena1"
 name = "My local var"
 indentation = 0
}
(*temporary) = "table expected, got nil"

Steps to reproduce:

  1. Put DevTool:AddData(unit, "My local var") to the line #273 of https://github.com/Sammers21/sArena_Updated2_by_sammers/blob/master/sArena.lua#L273
    image
  2. Save & reload the interface. Type /sarena and press test button. The bug grabber fill show the error
commented

The only reason that this error could happy is if DevTool.list had yet to be initialized, which means that you're trying to call the :AddData() function way too early in the loading process. I.e. you're trying to add things to DevTool before DevTool has even finished loading.

To try to mitigate this I've moved some things around to declare the DevTool.list table earlier in the load process, and I've added some error messages to handle this condition cleaner. But really, the solution is to wait until the PLAYER_LOGIN event, which is really the only guaranteed time that all addons are fully initialized.

I appreciate you bringing this to my attention.