[FREE / Open Source] Dynamic Variables - Create Dynamic Variables

Dynamic Variables

Simple extension for adding dynamic variables! You can rename, get values, delete and more!
P.S. I am just having fun making this extension. You can totally achieve these by dictionary lol

Blocks

Blocks Description
Raises when any error occured.

Params Type
error String
Initialize/ Change a variable with the given variable name and value.

Params Type
name Any
value Any
Initialize/ Change list of variables. Both list mustn't be empty. "names" and "values" must a list, and their length must be the same.

Params Type
names List
values List
Returns: Any
Get the value of a variable. If the variable doesn't exist, return null.

Params Type
name Any
Returns: List
Get a list of values. The input should be a list of variable's names. If any of the variables doesn't exist, that item will be null. If the input list is empty, or any errors occurred, return an empty list.

Params Type
names List
Returns: List
Get variables' names by its value. Return an empty list if there are no variables, or when error occured.

Params Type
value Any
Returns: List
Get all of the variable names. Return an empty list if there are no variables, or when error occured.
Returns: List
Get all of the values. Return an empty list if there are no variables, or when error occurred.
Rename a variable. If the old variable doesn't exist, error will occur.

Params Type
oldName Any
newName Any
Rename a list of varibles. All list must not be empty. Length of both list must be the same. If any one of the old names doesn't exist, error will occur.

Params Type
oldNames List
newNames List
Returns: Any
Remove a variable and return removed value. If the variable doesn't exist, return null.

Params Type
name Any
Returns: List
Remove list of variables and return a list of removed values. If any of variable's name doesn't exist, that item of the list will be null.

Params Type
names List
Remove all variables.
Returns: Boolean
Check if given variable name exists. Return true if variable exists, otherwise false. Return false if an error occurred.

Params Type
name Any
Returns: Boolean
Check if given value exists. Return true if value exists, otherwise false. Return false if an error occurred.

Params Type
value Any
Returns: Number (int)
Return the number of variables. Return -1 if an error occurred.
Returns: Boolean
Check if any variables exist. Return true if no variable exists, otherwise false. Return false if an error occurred.

Change Log

Version 2 (1.1)

  • Removed method code and error code; they are useless
  • Changed NumOfVariables to Size
  • Changed IsVariableExist to NameExist
  • Added ValueExist
  • Added GetNameByValue
  • Some methods return "null" instead of "not found"

Download

:github: Github

23 Likes

Great extension @WatermelonIce :partying_face: keep it up :+1:

it looks like you love YusufCihan dynamic components topic interface :crazy_face:

1 Like

Because it is neat and tidy :smiley:

Btw thanks for appreciation :laughing:

2 Likes

Yes it is :wink:

You’re welcome :grin:

1 Like

Nice Extension :100:

Yep, I also like it :grin:

2 Likes

Great extension @WatermelonIce :+1:t2:

nyc extension

1 Like

Can you please share a demo block?

For example, you can make a variable in this way:
image

Note this is not to save the value, only works when the app is still opened, like a normal variable.

2 Likes

Very very useful extension. :face_with_monocle: Thank you.

Getting error

Blocks

Error

This error isn’t related to dynamic variables(this topic) I think.

The error is because the add items to list block is expecting a list as parameter to list socket instead of a single item that you are currently passing

1 Like

Nice Extension!

I have one request, that is, get name and value from a file. Is this possible from with this extension?

Most possibly this reason.

@CJcorp If you can share the block image instead of using a phone to take pictures of the pc screen?

Thanks!

My extension has nothing to deal with files :sweat_smile:

But it has to deal with lists

It means we can’t use it in a loop where we add items to a list

You can, but you have to get it first.

like this:

ofc there is a more simple way to do it, this is for demonstration only.

1 Like

Ok will try it and will inform if it works or not for me

Edit :- working for me

1 Like

Great extension but which block do i need to use to change a variables value?