PDA

View Full Version : Cascading Lua Functions (As Oppossed To XML Templates)



dulux-oz
October 11th, 2014, 16:00
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

Trenloe
October 11th, 2014, 16:27
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.

dulux-oz
October 11th, 2014, 16:42
Hmmm, well that's annoying - thanks Tren

DMFirmy
November 2nd, 2014, 13:31
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.

Moon Wizard
November 4th, 2014, 18:01
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

darrenan
November 4th, 2014, 18:53
Any chance you're investigating a scripting language other than Lua for the future, something that supports inheritance for instance?

Moon Wizard
November 4th, 2014, 19:15
No plans currently. Lua will be script language of choice for now.

JPG

damned
November 4th, 2014, 22:52
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?

darrenan
November 4th, 2014, 23:48
Ok, maybe I should have said "in addition to" instead of "other than".