Download
(4 Kb)
Download
Updated: 06/01/24 12:42 PM
Pictures
File Info
Compatibility:
Scions of Ithelia (9.3.0)
Updated:06/01/24 12:42 PM
Created:05/29/24 06:36 PM
Monthly downloads:258
Total downloads:259
Favorites:0
MD5:
UI2Clipboard by theFeltes
Version: 0.1.1
by: theFeltes [More]
UI2Clipboard is an Addon for copying texts from ESO directly to your Clipboard.

Depends on:
LibAddonMenu-2.0 release 35 or higher.
Optional Files (0)


Archived Files (2)
File Name
Version
Size
Uploader
Date
0.1.0
4kB
theFeltes
05/30/24 12:40 AM
0.0.1
5kB
theFeltes
05/29/24 06:36 PM


Post A Reply Comment Options
Unread 05/31/24, 04:11 PM  
theFeltes
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 3
Uploads: 1
Originally Posted by Baertram
Often you'll find code like this at the top of functions too:
param1 = param1 or false

or

param1 = param1 or {}

It will just make sure the param1 will not be nil in the end and errors due to that if param1 will be accessed, so that's another way of definig a "fallback".
yeah, i code on LUAU daily, that's one of those things that every new programmer should know since it's so useful.
Report comment to moderator  
Reply With Quote
Unread 05/31/24, 01:37 PM  
Baertram
Super Moderator
 
Baertram's Avatar
ESOUI Super Moderator
AddOn Author - Click to view AddOns

Forum posts: 5063
File comments: 6136
Uploads: 78
Only for the control's params of the anchoring it does, yes.

As each control is anchored by default to it's parent control, you can leave the anchorTo controls empty and it will just use the parent control to anchor to then.

Other params like anchorMySide (e.g. LEFT) to the otherControlsSide (e.g. RIGHT, where otherControl would be parent then) will still bed used properly.

Often you'll find code like this at the top of functions too:
param1 = param1 or false

or

param1 = param1 or {}

It will just make sure the param1 will not be nil in the end and errors due to that if param1 will be accessed, so that's another way of definig a "fallback".

Originally Posted by theFeltes
so the anchor accepts a nil and defaults to something else? that's some weird choice of behavior if i've ever seen any.

Originally Posted by Baertram
If you do no define a variable explitily it will be created automatically once assigning a value, using the type you pass in to it.
But it's global then in the table _G and accessible to all other addons + overwriting other addon's/ZOs ESOUI code in _G table.

If the variable is not existing because nothing was assigned to it, it's nil and it's okay to have it in the code "until you try to access that variable somewhere". This will raise a nil error then.
-> The control's anchors accept nil values for some params (anchorToCntrol e.g.) so this would never error there for that param! If a reference control in an anchor is nil it will just use the parent control automatically afaik.
Report comment to moderator  
Reply With Quote
Unread 05/30/24, 11:57 AM  
theFeltes
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 3
Uploads: 1
so the anchor accepts a nil and defaults to something else? that's some weird choice of behavior if i've ever seen any.

Originally Posted by Baertram
If you do no define a variable explitily it will be created automatically once assigning a value, using the type you pass in to it.
But it's global then in the table _G and accessible to all other addons + overwriting other addon's/ZOs ESOUI code in _G table.

If the variable is not existing because nothing was assigned to it, it's nil and it's okay to have it in the code "until you try to access that variable somewhere". This will raise a nil error then.
-> The control's anchors accept nil values for some params (anchorToCntrol e.g.) so this would never error there for that param! If a reference control in an anchor is nil it will just use the parent control automatically afaik.
Report comment to moderator  
Reply With Quote
Unread 05/30/24, 09:40 AM  
Baertram
Super Moderator
 
Baertram's Avatar
ESOUI Super Moderator
AddOn Author - Click to view AddOns

Forum posts: 5063
File comments: 6136
Uploads: 78
If you do no define a variable explitily it will be created automatically once assigning a value, using the type you pass in to it.
But it's global then in the table _G and accessible to all other addons + overwriting other addon's/ZOs ESOUI code in _G table.

If the variable is not existing because nothing was assigned to it, it's nil and it's okay to have it in the code "until you try to access that variable somewhere". This will raise a nil error then.
-> The control's anchors accept nil values for some params (anchorToCntrol e.g.) so this would never error there for that param! If a reference control in an anchor is nil it will just use the parent control automatically afaik.


Originally Posted by theFeltes
Originally Posted by Baertram
Hi and welcome to ESO addon development.
Hint: Your released gui xml file is totally empty (allthough not called from your manifest txt so I guess it was added to the zip by accident).

And you are using LibAddonMenu2 in your lua file but it is not in your txt files dependencies!
You should add it as LibAddonMenu2>=36 and name all the (optional)dependencies at the addon description site please, as described here:
https://www.esoui.com/forums/showthread.php?t=10790
Thank you

Another hint about LAM:
registerForRefresh = true, is only needed if you got e.g multiple controls in your LAM panel and changing control1 should update the ohr controls's disabled state etc. (setfunc of control1 will run getFunc of all other controls of your panel then).
So currently it does not make sense to enable that in your LAM panel.

Found global leaking variables:

In function UI2Clipboard.ResetWinPos
vMP
Should be local vMP=UI2Data.vars["MenuPos"] I guess?

In your function UI2Clipboard.SetupMenu, line 220 you anchor a control to the control cButDrop
butTxt:SetAnchor(CENTER, cButDrop, CENTER, 0,hgtOS)
But cButDrop will be created later at lines 233ff so it is nil at that line 220


Your function TextToClipboard should be either local, or added to your global table UI2Clipboard.TextToClipboard instead of having it with that non-unique name.
Or rename it to UI2Clipboard_TextToClipboard for example.
Thanks for the help, All done. (unless i forgot something, which i hope i didn't)

About the nil var in the anchor, yeah, i usually use software that marks those things out for me, didn't think this project would justify installing VS so i just went with plain old Notepad++, guess i missed one, or two, considering vMP wasn't defined but still assignable, ESO's LUA is kinda weird coming from LUAU.
Last edited by Baertram : 05/30/24 at 09:42 AM.
Report comment to moderator  
Reply With Quote
Unread 05/30/24, 12:44 AM  
theFeltes
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 3
Uploads: 1
Originally Posted by Baertram
Hi and welcome to ESO addon development.
Hint: Your released gui xml file is totally empty (allthough not called from your manifest txt so I guess it was added to the zip by accident).

And you are using LibAddonMenu2 in your lua file but it is not in your txt files dependencies!
You should add it as LibAddonMenu2>=36 and name all the (optional)dependencies at the addon description site please, as described here:
https://www.esoui.com/forums/showthread.php?t=10790
Thank you

Another hint about LAM:
registerForRefresh = true, is only needed if you got e.g multiple controls in your LAM panel and changing control1 should update the ohr controls's disabled state etc. (setfunc of control1 will run getFunc of all other controls of your panel then).
So currently it does not make sense to enable that in your LAM panel.

Found global leaking variables:

In function UI2Clipboard.ResetWinPos
vMP
Should be local vMP=UI2Data.vars["MenuPos"] I guess?

In your function UI2Clipboard.SetupMenu, line 220 you anchor a control to the control cButDrop
butTxt:SetAnchor(CENTER, cButDrop, CENTER, 0,hgtOS)
But cButDrop will be created later at lines 233ff so it is nil at that line 220


Your function TextToClipboard should be either local, or added to your global table UI2Clipboard.TextToClipboard instead of having it with that non-unique name.
Or rename it to UI2Clipboard_TextToClipboard for example.
Thanks for the help, All done. (unless i forgot something, which i hope i didn't)

About the nil var in the anchor, yeah, i usually use software that marks those things out for me, didn't think this project would justify installing VS so i just went with plain old Notepad++, guess i missed one, or two, considering vMP wasn't defined but still assignable, ESO's LUA is kinda weird coming from LUAU.
Last edited by theFeltes : 05/30/24 at 12:46 AM.
Report comment to moderator  
Reply With Quote
Unread 05/29/24, 06:48 PM  
Baertram
Super Moderator
 
Baertram's Avatar
ESOUI Super Moderator
AddOn Author - Click to view AddOns

Forum posts: 5063
File comments: 6136
Uploads: 78
Hi and welcome to ESO addon development.
Hint: Your released gui xml file is totally empty (allthough not called from your manifest txt so I guess it was added to the zip by accident).

And you are using LibAddonMenu2 in your lua file but it is not in your txt files dependencies!
You should add it as LibAddonMenu2>=36 and name all the (optional)dependencies at the addon description site please, as described here:
https://www.esoui.com/forums/showthread.php?t=10790
Thank you

Another hint about LAM:
registerForRefresh = true, is only needed if you got e.g multiple controls in your LAM panel and changing control1 should update the ohr controls's disabled state etc. (setfunc of control1 will run getFunc of all other controls of your panel then).
So currently it does not make sense to enable that in your LAM panel.

Found global leaking variables:

In function UI2Clipboard.ResetWinPos
vMP
Should be local vMP=UI2Data.vars["MenuPos"] I guess?

In your function UI2Clipboard.SetupMenu, line 220 you anchor a control to the control cButDrop
butTxt:SetAnchor(CENTER, cButDrop, CENTER, 0,hgtOS)
But cButDrop will be created later at lines 233ff so it is nil at that line 220


Your function TextToClipboard should be either local, or added to your global table UI2Clipboard.TextToClipboard instead of having it with that non-unique name.
Or rename it to UI2Clipboard_TextToClipboard for example.
Last edited by Baertram : 05/29/24 at 07:01 PM.
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: