Page 1 of 1 1
Topic Options
#105495 - 2003-10-04 04:31 AM what is UDF?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I searched the friendly board and read the fab. FAQ but couldn't find answer to my question.

what is User Defined Function?
_________________________
!

download KiXnet

Top
#105496 - 2003-10-04 04:32 AM Re: what is UDF?
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
A UDF is a better subroutine construct with the ablility to have a return value like a function and set @error.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#105497 - 2003-10-04 04:37 AM Re: what is UDF?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hmm...
better than what?
_________________________
!

download KiXnet

Top
#105498 - 2003-10-04 05:04 AM Re: what is UDF?
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
A user defined function (UDF) is defined by the function...endfunction commands. The code placed in the UDF body should perform some valuable task.

A UDF is a better subroutine construct than gosub...return. It has the ability to return value like a function. Also, by using the "exit" command to leave the function, you can set the value of @error to the value passed to the exit comand as in "exit 87".
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#105499 - 2003-10-04 05:21 AM Re: what is UDF?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
quote:

A user defined function (UDF) is defined in script by user with the function...endfunction commands. The code placed in the UDF body should perform some valuable task.

A UDF is a better subroutine construct than gosub...return. It has the ability to return value like a function. Also, by using the "exit" command to leave the function, you can set the value of @error to the value passed to the exit comand as in "exit 87".

it works just like inbuild functions of kixtart except the facts that it is defined in the script-file or in called file and as it's parsed on-load of the script, it can be modified between each run thus making it more dynamic.

quote:
to read more on UDFs you might want to take look on these documentatory topics:
How to use UDFs
How to write a UDF

to see some UDFs written by the community, check on our UDF library collection which is currently hosting little over 400 UDFs

_________________________
!

download KiXnet

Top
#105500 - 2003-10-04 06:18 AM Re: what is UDF?
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Good topic of discussion!

Coming from the world of VB, I think of a UDF like an include. That is, a library of sorts that you can refer to later on in your code. A UDF can be simple or complex..

One way to think of this is something like a routine to "build a chair" where single commands would piece it together. If you are on the fence on going from 3.x to 4.x of KiXtart, it's beauty is that you can simplify, compact your current code without losing functionality. In our companys example, I was able to trim down from 102KB Login script to about 60KB and can be trimmed down further.

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#105501 - 2003-10-04 04:17 PM Re: what is UDF?
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
A UDF is the user-written equivalent to a KiXtart function. It aspires to mimic the input and output behavior of KiXtart functions including the way error codes are returned.

Generally, a UDF is written to perform a specific task.

UDFs are delimited by the FUNCTION-ENDFUNCTION commands and should include a comment header providing usage information modeled after the function information provided in the KiXtart Manual.
_________________________
There are two types of vessels, submarines and targets.

Top
#105502 - 2003-10-04 05:12 PM Re: what is UDF?
Jose Offline
Seasoned Scripter
*****

Registered: 2001-04-04
Posts: 693
Loc: Buenos Aires - Argentina
Basic ideas for starter: [Big Grin]
Functions are pices of code written in the same languaje (KiXstart in this case) with a start and an end delimited by the FUNCTION-ENDFUNCTION commands.

They can be placed anywhere in the same code you are working and when they are called to work they ussually are given values to return results for solving any task wished.

They are not magic inventions from god just packeges of very usefull code written by someone who wanted to solve a certain task and also be helpfull to others who can paste into their own code taking advantage of the writters skills. [Big Grin]

Thaaanks
_________________________
Life is fine.

Top
#105503 - 2003-10-04 10:44 PM Re: what is UDF?
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
quote:
They can be placed anywhere in the same code
This is something we should discourage. One should either assemble all UDFs on the topmost or the bottommost section of code or preferably have them in separate UDF/KXF files and included into the actual script via CALL functions.
_________________________
There are two types of vessels, submarines and targets.

Top
#105504 - 2003-10-12 09:10 PM Re: what is UDF?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
ok, now was thinking why this is missing from the faq...
it's because our FAQ here is not kixtart FAQ but korg BB FAQ

thus the questions, nor the answers are the same as would a real kixtart faq have.
_________________________
!

download KiXnet

Top
Page 1 of 1 1


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 657 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.069 seconds in which 0.033 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org