Log in

View Full Version : Newbie Questions About Development



VTHokie93
May 31st, 2024, 22:48
Hi All,

I've been developing on the Microsoft stack for more years than I care to mention, but this is my first experience with LUA.

I'm trying to develop an extension and I've got a couple of questions. First, I have been going through the Developer Guide, but there are things I just can't find. For instance, I see onTabletopInit() being used all over the place. I've dropped printstacks() in the functions and it looks like it's being called from outside the LUA scripts, so I thought I would see it in the docs, but I don't. Am I missing a secret knowledge cache somewhere?

Second, is a more specific coding question. For the 5E ruleset I would like to be able to modify functionality of the item_main.update() function. The 5E ruleset item_main looks like it completely hides the CoreRPG item_main. I don't want to take the same approach, as I assume that would not be friendly to other extension developers. So, I created my own item windowclass using merge="join" and added my own version of item_main to it. My onInit fires, but the update function is always called on the 5E item_main. Coming from an object-oriented world, I guess my question boils down to what is the proper way to do subclassing in lua so that I can extend the functionality of the 5E item_main?

Thank you in advance.

VTHokie93

VTHokie93
June 1st, 2024, 01:11
I was able to overcome my second problem after realizing that I had the wrong name in my windowclass.

and then thanks to SilentRuin's code where I saw how to user super.

My first question still remains. :)

damned
June 1st, 2024, 01:34
There are many steps that are not documented and the guidance is to use existing rulesets as examples.
My guess is that onTabletopInit() is being called by the engine - its also being called before the chat window is instantiated so you are not seeing your debug.
You can try adding Debug.console() and it should then be in console and in logs.

Moon Wizard
June 1st, 2024, 02:29
The onTabletopInit function is called on global scripts after the tabletop initializes (i.e. all desktop panels are instantiated and initialized). It's an easier replacement for the onDesktopInit event registration, which I plan to slowly sunset.

Regards,
JPG