Jump to content

To be or not to be inherited


TylerH
 Share

  

3 members have voted

  1. 1. How to do my Lua logic,math,info,filter entities pack?

    • Every entity (i.e. math_counter, logic_case, etc.) is entirely its own implementation directly from base class.
      0
    • A base entity implementation for each sub category (i.e. a math_base, logic_base, etc.) is created, and the entities for that category inherit it.
      3
    • Other. I won't explain and just be a jerk.
      0
    • Other. I will be a nice guy and post my explanation.
      0


Recommended Posts

This is a rather simple poll.

 

  1. Self explanatory.
  2. Basically means core stuff, such as the math entities' abilities to store numbers is core, and the specific entities manipulate it certain ways, i.e. math_base adds the ability to story a "value" key, math_add has the ability to add to it, math_subtract has the ability to subtract from it.
  3. For the LOLs.
  4. Sort of for the LOLs, or for people who think they are smarter than me.

:)

52t__nvidia.png nVidia 530M cpu.gif Intel Core i7 - 2.3Ghz 114229_30245_16_hardware_memory_ram_icon.png 8GB DDR3 RAM Windows7_Start.gif Windows 7 Ultimate (64x)

-----

IconVisualStudio16.png Visual Studio 2010 Ultimate google-Chrome.png Google Chrome PhotoshopLinkIndicator.png Creative Suite 5 icon28.gif FL Studio 10 MicrosoftOfficeLive.png Office 15

-----

csharp.png Expert cpp.png Professional lua_icon.png Expert BMX Programmer

-----

i-windows-live-messenger-2009.pngskype-icon16.pngaim_online.pnggmail.pngicon_48x48_prism-facebook.pngtunein-web.pngyahoo.giftwitter16.png

Link to comment
Share on other sites

I voted for option 2, it sounds like less duplicate code, and easier maintenance.

Although I think that intelligence is too slow for modern needs, and that intuition replaces it completely (referring to your option 4 comment).

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

Yes, my intuition lead me to vote for Option 2.

 

Good to see we agree. That alone is enough for me to decide to go with it, unless someone else provides an argument that can debunk intuition.

52t__nvidia.png nVidia 530M cpu.gif Intel Core i7 - 2.3Ghz 114229_30245_16_hardware_memory_ram_icon.png 8GB DDR3 RAM Windows7_Start.gif Windows 7 Ultimate (64x)

-----

IconVisualStudio16.png Visual Studio 2010 Ultimate google-Chrome.png Google Chrome PhotoshopLinkIndicator.png Creative Suite 5 icon28.gif FL Studio 10 MicrosoftOfficeLive.png Office 15

-----

csharp.png Expert cpp.png Professional lua_icon.png Expert BMX Programmer

-----

i-windows-live-messenger-2009.pngskype-icon16.pngaim_online.pnggmail.pngicon_48x48_prism-facebook.pngtunein-web.pngyahoo.giftwitter16.png

Link to comment
Share on other sites

There are other ways of doing inheritance, but my function renaming approach seemed the simplest to understand. One consideration was that if I was having trouble understanding table inheritance, many of my users would too, and that would have a negative impact on their experience and my sales.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

That is surprising. The inheritence in Lua is rather easy, if not, then Garry's Mod does hell of a good job at it.

 

I would recommend e-mailing garrynewman [at] gmail [dot] com and asking him how he set it up. In fact, I will do the same, too. He is usually quick to respond to professionals (non-12 year olds who know what they are speaking about), though he tends to swear a bit if you come off wrong.

52t__nvidia.png nVidia 530M cpu.gif Intel Core i7 - 2.3Ghz 114229_30245_16_hardware_memory_ram_icon.png 8GB DDR3 RAM Windows7_Start.gif Windows 7 Ultimate (64x)

-----

IconVisualStudio16.png Visual Studio 2010 Ultimate google-Chrome.png Google Chrome PhotoshopLinkIndicator.png Creative Suite 5 icon28.gif FL Studio 10 MicrosoftOfficeLive.png Office 15

-----

csharp.png Expert cpp.png Professional lua_icon.png Expert BMX Programmer

-----

i-windows-live-messenger-2009.pngskype-icon16.pngaim_online.pnggmail.pngicon_48x48_prism-facebook.pngtunein-web.pngyahoo.giftwitter16.png

Link to comment
Share on other sites

http://apache.dataloss.nl/~peter/www.lua.org/pil/

 

Chapters 15,16,17 are excellent. They taught me loads of new stuff I didn't know about.

 

You can change the environment (kind of like a new lua state) by calling setfenv(1, { })

 

Look into it, it is very promising. Those chapters describe everything from namespaces, to protoyping, inheritence, full OO patterns, weak tables, etc.

52t__nvidia.png nVidia 530M cpu.gif Intel Core i7 - 2.3Ghz 114229_30245_16_hardware_memory_ram_icon.png 8GB DDR3 RAM Windows7_Start.gif Windows 7 Ultimate (64x)

-----

IconVisualStudio16.png Visual Studio 2010 Ultimate google-Chrome.png Google Chrome PhotoshopLinkIndicator.png Creative Suite 5 icon28.gif FL Studio 10 MicrosoftOfficeLive.png Office 15

-----

csharp.png Expert cpp.png Professional lua_icon.png Expert BMX Programmer

-----

i-windows-live-messenger-2009.pngskype-icon16.pngaim_online.pnggmail.pngicon_48x48_prism-facebook.pngtunein-web.pngyahoo.giftwitter16.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...