FG Spreadshirt Swag
  1. #1

    referencing local variables (or not) in CoreRPG

    Hi Guys, I just want to make sure I have this right, before I look down a different path.

    in CoreRPG EffectManager, there is the following function

    Code:
    local fCustomOnEffectStartTurn = nil;
    function setCustomOnEffectStartTurn(f)
        fCustomOnEffectStartTurn = f;
    end
    If I have this right, if I call the setCustomOnEffectStartTurn(f) function with a reference to my new function then there is no way to be able to call an existing
    fCustomOnEffectStartTurn as mine will overwrite any previously set function?

    Cheers, Steve.

  2. #2
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Newcastle, UK (for a bit)
    Posts
    28,524
    Quote Originally Posted by Stv View Post
    If I have this right, if I call the setCustomOnEffectStartTurn(f) function with a reference to my new function then there is no way to be able to call an existing
    fCustomOnEffectStartTurn as mine will overwrite any previously set function?
    Correct. As fCustomOnEffectStartTurn is a variable local to the EffectsManager global script package, you can't access it from outside - so you can't make a copy of the previous script. The only vague option you may have is if you know where that override is set (i.e. it's in a ruleset layered on top of CoreRPG) and you can access that override function. But that won't help much if other extensions are changing it in different ways.
    FG Con 16 Fantasy Grounds Online RPG Convention - Friday April 16th Sunday 18th, 2021.
    www.fg-con.com for the latest info.
    FG Con 17: Friday October 15th Sunday 17th, 2021.

    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  3. #3
    That's what I thought
    I was hoping I could reference any previous to aid in cross-extension campatibility, guess it's 'last on to use it wins'

    I may well look down a different path to do what I want.

    As ever, thanks for the input Trenloe.

    Cheers, Steve.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
PF2E Playlist

Log in

Log in