mirror of
https://github.com/janet-lang/janet
synced 2025-02-03 18:59:09 +00:00
Fix janet_table_remove returning the key instead of the value
This commit is contained in:
parent
e08235b575
commit
7ea1c7d85a
@ -173,7 +173,7 @@ Janet janet_table_rawget(JanetTable *t, Janet key) {
|
|||||||
Janet janet_table_remove(JanetTable *t, Janet key) {
|
Janet janet_table_remove(JanetTable *t, Janet key) {
|
||||||
JanetKV *bucket = janet_table_find(t, key);
|
JanetKV *bucket = janet_table_find(t, key);
|
||||||
if (NULL != bucket && !janet_checktype(bucket->key, JANET_NIL)) {
|
if (NULL != bucket && !janet_checktype(bucket->key, JANET_NIL)) {
|
||||||
Janet ret = bucket->key;
|
Janet ret = bucket->value;
|
||||||
t->count--;
|
t->count--;
|
||||||
t->deleted++;
|
t->deleted++;
|
||||||
bucket->key = janet_wrap_nil();
|
bucket->key = janet_wrap_nil();
|
||||||
|
Loading…
Reference in New Issue
Block a user