enum equivalent?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
enum equivalent?
Hello LiveCoders,
I haven't found anything in documents or here that talks about enumerations in LiveCode. Am I missing something?
Thanks,
Brad
I haven't found anything in documents or here that talks about enumerations in LiveCode. Am I missing something?
Thanks,
Brad
Re: enum equivalent?
Hi.
Do you mean the ordering of elements of a defined set?
Craig Newman
Do you mean the ordering of elements of a defined set?
Craig Newman
-
- VIP Livecode Opensource Backer
- Posts: 10052
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: enum equivalent?
LiveCode does not currently include an enum function. In fact, thinking back on all the other tools I've used in this family of languages I can only recall one, SuperCard, that had an enum function.
But I'll bet we can write one for you easily enough. What would you like to do with it?
But I'll bet we can write one for you easily enough. What would you like to do with it?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: enum equivalent?
dunbarx wrote:Hi.
Do you mean the ordering of elements of a defined set?
Craig Newman
Basically just looking for an object type with a defined a set of constants that I can use to track different things, like application state. Not a deal breaker for me, but this kind of functionality helps. I am a C/C# developer, and use enums for lots of different things.
Re: enum equivalent?
Hi 2hup,
an enum is like a button of type option.
Probably you should see custom properties, setprop, and getprop.
However you can use any list, array, or comma defined list in the same way of an enum.
an enum is like a button of type option.
Probably you should see custom properties, setprop, and getprop.
However you can use any list, array, or comma defined list in the same way of an enum.
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
Re: enum equivalent?
Now I am confused.
Craig
2Hup, can you give an example of what you are trying to do? Is it object functionality, or language functionality?an enum is like a button of type option.
Craig
Re: enum equivalent?
Sorry for the delay in this response - I have been working on other projects for a bit.
I hope this is not insulting. I am a c# developer, so here is a reference link, in case you are not familiar with this concept.
http://www.dotnetperls.com/enum
I use this data type for a lot of different things, but it is basically a set of values that are defined. When an object of this type is instantiated, the developer, or user(if exposed to the user) can only set the value to what is in the pre-defined set.
Hope that helps.
I hope this is not insulting. I am a c# developer, so here is a reference link, in case you are not familiar with this concept.
http://www.dotnetperls.com/enum
I use this data type for a lot of different things, but it is basically a set of values that are defined. When an object of this type is instantiated, the developer, or user(if exposed to the user) can only set the value to what is in the pre-defined set.
Hope that helps.
Re: enum equivalent?
Hi.
If you are talking about a fixed, accessible one-to-one correspondence among elements of some kind in a data set of some kind, there are several ways to accomplish this. Arrays, custom properties and others come to mind. Mind you, LC is typeless, though I bet this will not matter at all.
But do you have enough experience with LC to give a more concrete example of what you are looking for?
Craig
If you are talking about a fixed, accessible one-to-one correspondence among elements of some kind in a data set of some kind, there are several ways to accomplish this. Arrays, custom properties and others come to mind. Mind you, LC is typeless, though I bet this will not matter at all.
But do you have enough experience with LC to give a more concrete example of what you are looking for?
Craig