Help for new addon programer
Hi guys,
I'm totally new in lua and addon programming. I'm trying to make my first addon but getting an ui error 'checking type on argument callback failed in ScriptEventManagerRegisterforEventlua stack traceback: [C]:addons/.... .lua 53 in function 'Initialize'. I googled it but couldn't find anything do u know why i am getting this error. Thanks. |
EVENT_MANAGER:RegisterForEvent("SomeGloballyUniqueString_PrefereablyYourAddonName", EVENT_CODE, callback)
callback must be a function, you're passing something else. Can't tell you more atm, error message is not enough, you'll need to give us the code that leads to it ;) |
oh sorry,but it is shame to share this bad algorithm and codes :) as i told this is my first addon and i did it for myself :)
Code:
local junker = { |
Local function "junkJunk" must be defined before line where it is called. Fixed code:
lua Code:
If you want also make this code a bit faster, do not use function "contains", but define your tables as follows and just check if table keys exists: Lua Code:
|
Lua Code:
edit: but neither will do what you need, see below, circonian has it right ;) |
In this code:
Lua Code:
GetItemType(bagId,slotId) could return ITEMTYPE_ARMOR if the item is a piece of armor, but ITEMTYPE_ARMOR is actually an integer, so you can't compare it to a string with: Lua Code:
You might want to change your tables to something like this: Lua Code:
Then when your trying to determine if something is junk or not you don't need to call an extra contains(...) function. you can just check that table to see if it is true/false (junk or not junk) Lua Code:
Oh and so the other part of your code would have to be changed to: Lua Code:
|
Ah, circonian is right. I didn't think about what should be in the table. Tables should be defined as circonian said.
Quote:
Lua Code:
|
Quote:
Oh yeah, I didn't catch that one, I just copied what he had and took the ""s off Hes right, if you do Lua Code:
Depending upon what your going to do with it, you may or may not need it outside of that if statement. If you do then you'll have to do what he said. Lua Code:
|
guys i m realy gratefull for your interest, thanks :) it was really helpfull and instructive. now thanks to u i have my own addon :banana:
|
All times are GMT -6. The time now is 11:14 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI