Frames and metatables
If I have a frame, and the put a metatable on this all this methods, e.g. SetBackdropColor(), are overwritten. There's a solution to overcame this problem?
Lua Code:
Error message: attempt to call method 'SetBackdropColor' (a nil value) |
You haven't actually set a backdrop to colour.
|
You can get the original metatable of the frame and set that as your new metatable's metatable, eg.
Lua Code:
|
You can also copy functions from the old metatable to the new one. This will impose a longer setup time and use up more memory, but will save CPU usage during runtime. Taint is also a problem if the frame is protected, but it's unclear whether the replacement of the frame's metatable would cause taint by itself anyway.
Lua Code:
|
It may cause taint, you don't need to replace the frame's meta, it is better to creating a wrapper of the frame like :
Lua Code:
|
All times are GMT -6. The time now is 01:13 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI