Adding new things to global functions?
lua Code:
Let's say I have two addons. I would like to, from my addon, be able to add my words into "thelist", but it's a local variable. However, IntheList(name) is a global function, is there anyway override the global function from MY addon and make it return "thelist[name] AND theotherlist[name];"?, or manually (without editing the original addon) to add my words into thelist? qts;dfr (question too stupid, didn't finish reading): Is there a way to make IntheList(name) return from anything OTHER than just thelist[name] without editing the original addon? |
Sure. Since it's a global function, you can either completely replace it or hook it.
|
Hooking seems to be what I'm after, but I honestly have no idea on how that works. I've tried looking up examples of Hooksecurefunc, but it's like reading Chinese in Spanish to me.
lua Code:
doesn't seem to work. Code:
Interface\AddOns\TrueAui\test.lua:24: hooksecurefunc(): InTheList() is not a function |
Get rid of the parentheses. ;) They're not a part of your function name.
|
Yeah, I tried that, but it just ends up throwing out the same error. I definitely know that function is there, but I'm thinking it just hates me. C_C
Code:
Interface\AddOns\TrueAui\test.lua:6: hooksecurefunc(): RDXDB.IsProtectedPkg is not a function File #1 lua Code:
File #2 lua Code:
|
Quote:
lua Code:
Even if you did fix that though, it still wouldn't work since hooks from hooksecurefunc discard your return values and preserve the original ones. You would have to manually (insecurely) hook the function like this: lua Code:
|
Thanks Saiket, and Seerah for helping me through this! :)
If I may ask, what does the ... signify as a function operator? (I think that's what it's called) |
Quote:
|
Ah! I see, cool stuff! :) Thanks for the quick reply! :D
|
Quote:
lua Code:
|
All times are GMT -6. The time now is 12:38 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI