contracts/2.fc:48:5: error: undefined function `dictval`, defining a global function of unknown type
dictval~udict_set_ref(128, value, msg);
^
lvalue expression constructor is 8
fatal: cannot compile lvalue expression with unknown constructor
Does anyone know how to fic this
Dec 20, 2022, 9:17 PM
in this case, dictval is only defined inside of if {} or else {} block. it's not visible outside of it.
you can define it before if (), and then just set the value in it
you can define it before if (), and then just set the value in it
Dec 20, 2022, 9:20 PM
so would i just do like cell dictval = 0? because just cell dictval; gave an error
Dec 20, 2022, 9:21 PM
you can do cell dictval = null()
Dec 20, 2022, 9:22 PM
is there a way to set integers as value in dictionaries, or a way to convert form slice to int and back
Dec 20, 2022, 9:33 PM
values are always slices. you can simply store a single integer in a slice if you only need it in a value.
int to slice:
int value = 123;
slice slice_from_int = begin_cell().store_uint(value, 256).end_cell().begin_parse();
slice to int:
slice value = {{{dict get or something else}}}
int int_from_slice = value~load_uint(256)
int to slice:
int value = 123;
slice slice_from_int = begin_cell().store_uint(value, 256).end_cell().begin_parse();
slice to int:
slice value = {{{dict get or something else}}}
int int_from_slice = value~load_uint(256)
Dec 20, 2022, 9:40 PM
oh ok
Dec 20, 2022, 9:40 PM