The Help for The Family Historian API defines a 'Hungarian' notation for parameters.
i.e.
ptr = pointer object
dt = date object
dp = date-point object
str = text string
i = integer
b = boolean (true or false)
tbl = Lua table of values
However, the Sample Plugin Scripts do not always adhere to this notation.
e.g.
Some pointer objects are simply pi or pf.
Some text strings start with s instead of str.
Some variables do not use the notation at all.
The IUPLUA GUI builder examples tend to use similar notations for its data types.
1) Should the FH API Sample Plugin Scripts be improved to use its notation more faithfully?
2) Should LUA scripts use a similar notation as good style, even where not using the FH API?
3) Should Knowledge Base LUA code snippets follow a similar style guide?
If so perhaps a few more 'Hungarian' prefixes are needed.
e.g.
num or fp = floating point number
etc...
ID:5409
* Plugin Variable Notation
- tatewise
- Megastar
- Posts: 27076
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Plugin Variable Notation
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
- tatewise
- Megastar
- Posts: 27076
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Plugin Variable Notation
A few more thoughts...
Personally I prefer the prefix int to i and boo or bln or flg to b.
Also any function that returns a value should use a similar 'Hungarian' prefix.
To aid understandability and debugging, I suggest that intentionally global variables (and global functions) should start with a capital letter.
e.g.
Ptr, Str, Int, etc...
Personally I prefer the prefix int to i and boo or bln or flg to b.
Also any function that returns a value should use a similar 'Hungarian' prefix.
To aid understandability and debugging, I suggest that intentionally global variables (and global functions) should start with a capital letter.
e.g.
Ptr, Str, Int, etc...
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry