So I’m currently scripting multiple systems, ranging from combat to inventory.
Each system is made up of a server and client handler and multiple functions, where each function is initialized with base/constant data and then called to run the function.
Would it be better to have it stay that way, or is it better using a global metatable with metamethods that replace the functions, and end the need for the initialization function.
EXAMPLE
So currently, the Inventory system is made up of these functions:
- AddItem
- RemoveItem
- EquipItem
- UseItem
- SetupSlot --LOCAL SIDED ONLY
Each of these functions (except the last one) are made up of server side, and local side functions.
I was thinking of having a metatable that contains the inventory data, where each slot has these functions.
You simply call the server method on server, fire client, connect to local method on local.
So the question is, which of these are more efficient and better all-in-all?