FG Spreadshirt Swag
  1. #1

    Question Cascading Lua Functions (As Oppossed To XML Templates)

    Hi Guys,

    I can't seem to find if this has been asked before, so here goes:

    Is there ANY way to take only one or two functions from an Lua file and modify them so that they "replace" the originals, or do we HAVE to replace the entire Lua file with a new one of the same name (and thus duplicating 95% of the original file)?

    -OR-

    To put it another way, is there the XML "Merge Rules" functionality for the Lua files?

    I'd like to change three functions in the CoreRPG manager_chat.lua file for use in my derived MJBCore Ruleset, and I find it a waste to duplicate all but 5% of the original file (you can tell I'm an "old-time" coder, where resources were scarce and we saved space, CPU-Cycles and RAM wherever we could)

    Thanks in advance
    Dulux-Oz

    √(-1) 2^3 Σ Π
    ...And it was Delicious!


    Alpha-Geek
    ICT Professional
    GMing Since 1982
    NSW, Australia, UTC +10
    LinkedIn Profile: www.linkedin.com/in/mjblack

    Watch our games on Twitch: www.twitch.tv/dulux_oz

    Support Me on Patreon: www.patreon.com/duluxoz

    Past Games, etc, on my YouTube Channel: www.youtube.com/c/duluxoz

  2. #2
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,362
    You have to duplicate the whole file.

    You can make changes to the original in a way that the original functions call new functions - similar to the custom functions in manager_combat.lua and manager_combat2.lua. But this would require modifying manager_chat.lua and including the whole of that in your extension/ruleset. So it doesn't get around your base issue.

    In the past M_W has said that he'll consider doing something similar for other integration points, so drop him a message regarding the areas you're looking to change.
    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
    Hmmm, well that's annoying - thanks Tren
    Dulux-Oz

    √(-1) 2^3 Σ Π
    ...And it was Delicious!


    Alpha-Geek
    ICT Professional
    GMing Since 1982
    NSW, Australia, UTC +10
    LinkedIn Profile: www.linkedin.com/in/mjblack

    Watch our games on Twitch: www.twitch.tv/dulux_oz

    Support Me on Patreon: www.patreon.com/duluxoz

    Past Games, etc, on my YouTube Channel: www.youtube.com/c/duluxoz

  4. #4
    I would like to put in my "seconded" for this idea. I was wondering something similar myself, and think this would be an extremely useful feature that could prevent the possibility of something being broken in a child ruleset when the parent ruleset gets updated. Any files that were updated in the parent would then need to have their changes reflected in any child ruleset files that are overwritten, which may not be immediately obvious.

  5. #5
    You can currently do this with windowclass and windowcontrol objects (using merge="join" for windowclass redefinition and using templates for windowcontrols).

    I'm assuming you are looking for the ability to override scripts for the global script tag? Or something else?

    If so, please add to wish list for tracking. It will require adding some sort of merge tag to the global script tag processing.

    Cheers,
    JPG

  6. #6
    Any chance you're investigating a scripting language other than Lua for the future, something that supports inheritance for instance?

  7. #7
    No plans currently. Lua will be script language of choice for now.

    JPG

  8. #8
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,654
    Blog Entries
    1
    Quote Originally Posted by darrenan View Post
    Any chance you're investigating a scripting language other than Lua for the future, something that supports inheritance for instance?
    Moving away from LUA would break every existing ruleset?

  9. #9
    Ok, maybe I should have said "in addition to" instead of "other than".

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
  •  
DICE PACKS BUNDLE

Log in

Log in