Variable prefix in examples

LiveCode Builder is a language for extending LiveCode's capabilities, creating new object types as Widgets, and libraries that access lower-level APIs in OSes, applications, and DLLs.

Moderators: LCMark, LCfraser

Post Reply
seaniepie
Posts: 154
Joined: Wed Sep 07, 2011 10:56 am

Variable prefix in examples

Post by seaniepie » Fri Mar 27, 2015 6:14 pm

Hi All,

So we are used to the prefixes of t(temp), p(parameter), g(global), s(script-wide) and k(konstant) in Variables (or constants in the case of k). In Livecode builder scripts though I have notices the 'm' prefix. Just wondering what that symbolised.

Thanks
Pi

LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 1209
Joined: Thu Apr 11, 2013 11:27 am

Re: Variable prefix in examples

Post by LCMark » Fri Mar 27, 2015 7:08 pm

@seaniepie: We use 'm' in widget scripts to indicate a 'member' variable. It signifies that there is one copy of the variable per instance of the widget. We use 's' in library scripts as there is only one copy - as libraries are global. The reason for the distinction is that we will be changing things slightly so widgets will be definitions in a library, and thus a widget will have access to both its 'member' variables and variables of the library it is defined in.

peter-b
Posts: 182
Joined: Thu Nov 20, 2014 2:14 pm
Location: LiveCode Ltd.

Re: Variable prefix in examples

Post by peter-b » Thu Apr 02, 2015 9:53 am

seaniepie wrote:So we are used to the prefixes of t(temp), p(parameter), g(global), s(script-wide) and k(konstant) in Variables (or constants in the case of k). In Livecode builder scripts though I have notices the 'm' prefix. Just wondering what that symbolised.
Just a note: you can call your variables anything you like, but we recommend using the prefixes you mention because it helps understand what sort of variables the code is using.
LiveCode Open Source Team — @PeterTBBrett — peter.brett@livecode.com

Post Reply

Return to “LiveCode Builder”