[DGD] LPC_mapping in kfun extension

nikoroleva . natasha.i.koroleva at gmail.com
Mon Jul 31 23:50:18 CEST 2017


I have created this kfun extension to return a mapping and in the
returned mapping the key is the value. Is it my mistake?

https://gist.github.com/november-kilo/27d9f2308d6ce8a05e446db82c0ff94c

LPC_dataspace data;
LPC_mapping mapping;
LPC_value mapping_key, mapping_value;
LPC_string key_str, val_str;
char key[100];
char val[5];
data = lpc_frame_dataspace(f);
mapping_key = lpc_value_temp(data);
mapping_value = lpc_value_temp(data);
sprintf(key, "key_%d", 1);
sprintf(val, "val_%d", rand());
key_str = lpc_string_new(data, key, strlen(key));
val_str = lpc_string_new(data, val, strlen(val));
lpc_string_putval(mapping_key, key_str);
lpc_string_putval(mapping_value, val_str);
mapping = lpc_mapping_new(data);
lpc_mapping_assign(data, mapping, mapping_key, mapping_value);
lpc_mapping_putval(retval, mapping);



More information about the DGD mailing list