To download this library for your Linux/Mac installation, enter this on your command line:
DreamDownload byond://Kaiochao.LazyMacros##version=1 Emulator users, in the BYOND pager go to File | Open Location and enter this URL:byond://Kaiochao.LazyMacros##version=1 |
Easy macros for common lazy-initialization patterns.
These are all inline expressions, but they work best with the first argument being a variable. (e.g. a, a.b, a.b.c, etc., not A()) ReferenceLazyAssign(x, y) X should be a variable that can be assigned to. Initialize X to Y if it isn't already initialized. Evaluates to the resulting X. LazyListAdd(list, item) LIST should be a variable that can be assigned to. Initialize LIST if necessary, then add ITEM to it. Evaluates to LIST. LazyListRemove(list, item) LIST should be a variable that can be assigned to. If LIST exists, remove ITEM from it, and de-initialize LIST if it's empty. Evaluates to LIST on successful removal. Evaluates to null if LIST doesn't exist. Evaluates to FALSE if ITEM is not in LIST. LazyMap(list, key, value) LIST should be a variable that can be assigned to. Initialize MAP if necessary, then map a key to a value. Evaluates to VALUE. LazyIndex(list, key) Gets the value associated to KEY in MAP. Doesn't initialize MAP. Evaluates to MAP if MAP does not exist. Evaluates to MAP[KEY] otherwise. LazyInclude(list, item) LIST should be a variable that can be assigned to. Initialize SET if necessary, then include ELEMENT in it. Evaluates to LIST. |
Please support BYOND through Membership or a donation!
|
Related Libraries
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
More Libraries by Kaiochao
|
Copyright © 2024 BYOND Software.
All rights reserved.