Function Prototypes (Code related)

View previous topic View next topic Go down

Function Prototypes (Code related)

Post  ArielMD2 on Tue Dec 18, 2012 11:48 am

Hey, Kaedrin,

I was picking through your scripts and I noticed a lack of the use of function prototyping. It seems odd to deliberately exclude their use, so I was curious as to the reason. Does the script interpreter work more quickly without them or what?

ArielMD2

Posts : 5
Join date : 2012-12-18

View user profile

Back to top Go down

Re: Function Prototypes (Code related)

Post  Kaedrin on Tue Dec 18, 2012 2:23 pm

NWN2 does not get any benefit from it that I'm aware of so I didn't bother spending the time doing it. Not all languages use or support them in a meaningful fashion.

Kaedrin
Admin

Posts : 352
Join date : 2011-04-15
Age : 42

View user profile http://nwn2customcontent.forumotion.com

Back to top Go down

Re: Function Prototypes (Code related)

Post  ArielMD2 on Tue Dec 18, 2012 2:41 pm

It has a couple.

1) It provides documentation for function actions. When using compatible editors (NWN2 default script editor, plugins for other common editors) whatever comments you preface a function will show up when you highlight the function, additionally the function can be searched for in the NWN2 scripting environment. Essentially, it improves the ability of the code to be self documenting.

2) It's a C convention, which the scripting language is emulating. It's also the default convention for the NWN2 scripting in general. I believe it helps prevent arity errors, which is why it's the C convention, but I've never tested it in NWN2.

ArielMD2

Posts : 5
Join date : 2012-12-18

View user profile

Back to top Go down

Re: Function Prototypes (Code related)

Post  Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum