Skip to content

[BUG] bad argument #1 to 'insert' #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Sammers21 opened this issue Jan 27, 2024 · 1 comment
Closed

[BUG] bad argument #1 to 'insert' #11

Sammers21 opened this issue Jan 27, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@Sammers21
Copy link

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
@Sammers21 Sammers21 added the bug Something isn't working label Jan 27, 2024
@Sammers21 Sammers21 changed the title [BUG] [BUG] bad argument #1 to 'insert' Jan 27, 2024
@brittyazel
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants