Object-Oriented Programming Question

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.


So currently, the Inventory system is made up of these functions:

  1. AddItem
  2. RemoveItem
  3. EquipItem
  4. UseItem
  5. 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?

1 Like

There isn’t much difference since there are no functions that will have to be run very often (per-frame kind of often). I would just leave it be as you already have a system set up.

1 Like