STAR TREK 2d20
  1. #1

    Error in extension call to [string "5E:scripts/manager_actor_5E.lua"]:204

    Recently since last major release I've been having my players get this error

    [ERROR] Handler error: [string "5E:scripts/manager_actor_5E.lua"]:204: attempt to index local 'sAbility' (a number value)

    on a polymorphism extension call. Only after several hours of playing and if we exit game and come up it does not happen again.

    Nowhere in the poly code does it call ActorManager5E.getAbilityBonus with a number.

    It only calls it in 3 places:

    Code:
    		rRoll.nTarget = 8 + ActorManager5E.getAbilityBonus(rSource, aPowerGroup.sSaveDCStat) + ActorManager5E.getAbilityBonus(rSource, "prf") + aPowerGroup.nSaveDCMod;
    and

    Code:
    						for k, v in pairs(DataCommon.skilldata) do
    							local sBestLabel = "";
    							local nBestMod = 0;
    							local nNPCBestMod = 0;
    							local nBonus = ActorManager5E.getAbilityBonus(rnodeNewCTEntryActor, v.stat);
    and

    Code:
    						for k, v in pairs(DataCommon.ability_ltos) do
    							local nBonus = ActorManager5E.getAbilityBonus(rnodeNewCTEntryActor, k);
    None of these are numbers in the 2nd arg of getAbiliyBonus.
    Free(Forums/Forge) Extension(FGU 5E):
    Paid (Forge) Extension(FGU 5E):

  2. #2
    If you do a global search for ActorManager5E.getAbilityBonus, you'll see that none of the built-in ruleset calls use numbers either.
    Also, I haven't heard of this issue reported in standard 5E ruleset usage without extensions.

    Regards,
    JPG

  3. #3
    Quote Originally Posted by SilentRuin View Post
    Recently since last major release I've been having my players get this error
    Code:
    		rRoll.nTarget = 8 + ActorManager5E.getAbilityBonus(rSource, aPowerGroup.sSaveDCStat) + ActorManager5E.getAbilityBonus(rSource, "prf") + aPowerGroup.nSaveDCMod;
    if aPowerGroup.sSaveDCStat is an array then it needs to be indexed

  4. #4
    Quote Originally Posted by rhagelstrom View Post
    if aPowerGroup.sSaveDCStat is an array then it needs to be indexed
    Was not aware it could be an array - thank you! I'll put something in and see if the issue goes away for me. Seems to only be for me as noone else has reported it and if I restart app it goes away.
    Free(Forums/Forge) Extension(FGU 5E):
    Paid (Forge) Extension(FGU 5E):

  5. #5
    In the 5E code, it's only set in these lines of code (top two for aPowerGroup.sSaveDCState, bottom two for aPowerGroup.sStat). The default calls would not be setting to non-string type. Not sure where array reference idea came from...

    aPowerGroup.sSaveDCStat = DB.getValue(nodePowerGroup, "savestat", "");
    ...
    aPowerGroup.sSaveDCStat = aPowerGroup.sStat;
    ...
    aPowerGroup.sStat = DB.getValue(nodePowerGroup, "stat", "");
    ...
    aPowerGroup.sStat = sDesc:match("spellcasting ability is (%w+)") or "";
    ...

    Regards,
    JPG

  6. #6
    Array comment was based on name prefix of a - and of course the crazy dual purpose of getPowerGroupRecord being able to return a aPowerGroup.data or aPowerGroup["level"] depending if nodePower argument is nil or not. Granted the latter is not going to be triggered in my calls but still - doing a dual purpose like this can cause confusion.

    Right now not sure why the same code works but at some point can get "corrupted" by something - and I do use extensions. I just can't seem to duplicate the error (only seen since last major update) unless in a live game in this campaign for more than an hour and this PC tries to wild shape with polymorphism. Never seen again if we restart app for that session. Until I can duplicate it I'm just trying to guess by looking at the code. I'm not even sure its my code triggering the error.
    Free(Forums/Forge) Extension(FGU 5E):
    Paid (Forge) Extension(FGU 5E):

  7. #7
    I'm not sure what you are saying.

    * getPowerGroupRecord always returns a Lua table or Lua nil value. (aPowerGroup.data == aPowerGroup["data"]; and aPowerGroup.level == aPowerGroup["level"])
    * Having functions return a nil value when data can't be found is very common in the code base.

    Regards,
    JPG

  8. #8
    Quote Originally Posted by Moon Wizard View Post
    I'm not sure what you are saying.

    * getPowerGroupRecord always returns a Lua table or Lua nil value. (aPowerGroup.data == aPowerGroup["data"]; and aPowerGroup.level == aPowerGroup["level"])
    * Having functions return a nil value when data can't be found is very common in the code base.

    Regards,
    JPG
    Sorry I should have put aPowerGroup[nLevel] = aSpells; - which is an array for a level being returned. You'd have to actually look at the PowerManager.getPowerGroupRecord code to see it. What I'm saying is true - I'm just stating it wrong (when I go by memory its unreliable)- its using that array as dual purpose. Unless I've completely lost it looking at code here.
    Free(Forums/Forge) Extension(FGU 5E):
    Paid (Forge) Extension(FGU 5E):

  9. #9
    My current theory is that something is calling PowerManager.getPowerGroupRecord (I do but not with nil arg) with the second arg nil then trying to use the result someplace with getAbilityBonus given the assumed non array result which turns into a number instead of string when referencing data since its an unexpected array coming back. But really I have no idea.

    I'll have to wait till i can figure out how to duplicate it - which only seems to be when in a session doing lots of stuff for a while before triggering the polymorphism.
    Last edited by SilentRuin; April 23rd, 2024 at 17:25.
    Free(Forums/Forge) Extension(FGU 5E):
    Paid (Forge) Extension(FGU 5E):

  10. #10
    My solution for now is to guard all my calls mentioned on first page with

    type(whatever) == "string"

    Before I allow it to process. And if its not a string I'm going to do a printstack() to see what is causing this. If its my call even triggering the error call.
    Free(Forums/Forge) Extension(FGU 5E):
    Paid (Forge) Extension(FGU 5E):

Thread Information

Users Browsing this Thread

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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
FG Spreadshirt Swag

Log in

Log in