Author Topic: Function system  (Read 1589 times)


  • Newbie
  • *
  • Posts: 10
  • ?
    • S Universal Group - website
Function system
« on: October 02, 2020, 11:33:37 AM »
Hello, I want to know How can I create a 'function' (user-defined procedure) and create a 'plug-in' (plug-in procedure)?
I will ask the thing I doesn't know.


  • Administrator
  • Newbie
  • *****
  • Posts: 430
  • Here to help you
Re: Function system
« Reply #1 on: October 03, 2020, 08:11:02 AM »
Yes it is possible to create your own user-defined functions but they are clumsy to call compared to a HN defined function.

In most programming languages the user-defined and language defined function usages are very similar.

Here is how to do it in HN:-

(1) Create a procedure for instance MyAddFN with any required parameters
     You can create your procedure in a the MainCode section where it will be global.
     Procedures can also be created in cards, buttons etc, where they will be local.

Code: [Select]
@ MyAddFN(n1,n2) - simply adds 2 numbers together
Global myResultAddFN

Put n1 into myResultAddFN

Add n2 to myResultAddFN

(2) In your button place the call to your procedure MyAddFN

Code: [Select]
Global myResultAddFN

Call MyAddFN(2,3)

Put myResultAddFN into field 1
@ 5 should appear in field 1

I try to keep the global variable names similar to the user-defined functions(procedure) because its easier to keep track of them in large programs. However, you can name your global variables anything, as long as they don't conflict with a HN keyword or other variable.

Creating a Procedure

Procedures are created in the Script Editor using the New, Edit, Del buttons in the lower left of the editor window.
Procedures are listed in the listbox directly above these 3 buttons.
Just make sure that you have selected the correct control, card or MainCode before creating your procedure.


This post might help in creating procedures, also know as handlers:-
« Last Edit: October 03, 2020, 08:57:50 AM by Malkom »
I am sorry but I do not have time to answer questions by PM or email.
If you post your questions in this forum then it might help others.