-
October 19th, 2017, 12:29 #11
Archangel
- Join Date
- Apr 2008
- Location
- Virginia Beach
- Posts
- 3,096
It sounds like it. I don’t think the super and self references are in scope inside a lua code file only in an interface xml file. That is, only within scripts attached to controls. I could be wrong, but I cannot imagine the complexity in the code interpreter to try and derive the self-super context in a code file that could be called from an unlimited number of contexts.
I think what you are saying is the best you can hope for.
-
October 19th, 2017, 22:40 #12
I could have sworn I used self. in one of my lua files...
I never claimed to be sane. Besides, it's more fun this way.
-
October 20th, 2017, 01:50 #13
Archangel
- Join Date
- Apr 2008
- Location
- Virginia Beach
- Posts
- 3,096
I admit I could be wrong. Maybe MW will chime in here? Or Trenloe?
-
October 20th, 2017, 02:02 #14
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,541
Theoretically, the window class merge code does the same super/self variables and layering. However, the assumption right now is that scripts used in window class merges will completely replace all functions, so it hasn't been tested.
Regards,
JPG
-
October 20th, 2017, 05:10 #15
Not to be argumentative, especially with the master, but isn't that what we did in post 11 of this thread. In that post we replace the setCategoryHeader() function with one defined in the windowclass .xml.
I have since reworked it. Instead of replacing a function I supplement them.
Here are the first 6 lines of the power_group_header windowclass in the rulesets\5E\campaign\record_power.xml file:
Code:<windowclass name="power_group_header"> <margins control="0,0,0,5" /> <script file="campaign/scripts/power_group.lua" /> <sheetdata> <hsc name="group" /> <hnc name="level" />
And then here are a few lines from my extension where I "supplement" the script:
Code:<windowclass name="power_group_header" merge="join"> <script merge="join"> function setHeaderCategoryForPsionics(rGroup, sGroup, nLevel, sName) name.setValue(sName); level.setValue(nLevel); group.setValue(sGroup); setNode(rGroup.node); end </script> </windowclass>
(Please believe me, I am okay with this, it seems only prudent.)
But it does seem to be working the way I wish, as supplementing the script rather than complete replacement.Last edited by Minty23185Fresh; October 20th, 2017 at 05:16.
Current Projects:
Always...
Community Contributions:
Extensions: Bardic Inspiration, Druid Wild Shapes, Local Dice Tower, Library Field Filters
Tutorial Blog Series: "A Neophyte Tackles (coding) the FG Extension".
-
October 20th, 2017, 05:21 #16Current Projects:
Always...
Community Contributions:
Extensions: Bardic Inspiration, Druid Wild Shapes, Local Dice Tower, Library Field Filters
Tutorial Blog Series: "A Neophyte Tackles (coding) the FG Extension".
-
October 20th, 2017, 12:20 #17
Archangel
- Join Date
- Apr 2008
- Location
- Virginia Beach
- Posts
- 3,096
I don’t think you can use self and super in lua files not associated with controls. That is if you call a manager you create (e.g. MyManager.myRoutine) you cannot use self and super in that file. The lua has to be tied to a control, either as a script or referenced in a control. It is just like if you invoke a function in a different lua file you cannot get to locals declared in that lua file from where you invoked it. But I could be wrong....
-
October 20th, 2017, 15:23 #18
I would completely agree. They would lack the layering context. It was easy enough to test too.
I was using some tiny "manager" scripts to try to derive a methodology for true function copying. That's what originally spawned this thread. I put some selfs and supers in the start up manager and in the managers called by managers. All selfs and supers were nil.
Not an unequivocal confirmation, but sufficient enough for me.
-
October 20th, 2017, 17:17 #19
Archangel
- Join Date
- Apr 2008
- Location
- Virginia Beach
- Posts
- 3,096
Great. The world makes sense again. Good work!
-
October 20th, 2017, 21:35 #20
Never argue with the master! I believe I should recant. We didn't replace the function as we do in global, "manager type" scripts. We supplemented.
In both cases I mentioned above, the new script resides in the extension layer. If I were to iterate through the elements ("variables") of the extension the "replacement" function would be there and the "replaced" function would still exist in the ruleset layer. (That's what all my complaining was about in the other thread.)
You can teach me new tricks, it just takes a lot time for stuff to sink in.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks