![]() |
enum and makevar
Do makevar() even work with enum?
PHP Code:
HTML Code:
TEST: |
enums are for mainly integers, not strings. I think you want to use consts for strings, i.e.
PHP Code:
|
Quote:
PHP Code:
HTML Code:
TEST: Edit: this is what I originally tested/needed it for: PHP Code:
HTML Code:
Food: 0Becuase I need the index of the current category for something I am working on.. |
I guess it doesn't work, then. consts and enums probably aren't in the same variable scope, or are preprocessed during bytecode compilation, I'm not sure.
|
Quote:
|
Quote:
|
Quote:
PHP Code:
HTML Code:
TEST:PHP Code:
HTML Code:
Food: 0 |
Couldn't one use TStaticVar in place of an enum?
It would work about the same and be accessible from other objects. It might require you to type a little bit more but its more useful in the end, yes? |
Consts and enums are const values which are replacing script variables at compile-time, that's why you cannot use consts/enums from other scripts either. The are basicly what "defines" are in C/C++/Pascal etc.
If you want a dynamic variable then create a dynamic variable (this.foo etc.) |
But in the end its unlikely the values will be modified anyhow, unless some other person with NC changes them, but them thats easy to avoid. So I can't see a reason to use constants or enums considering their inability to be used outside of the current object, thats why I would use a static var.
Just my two cents. |
| All times are GMT +2. The time now is 03:52 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.