Skip to content

Commit

Permalink
Allow retrieving JSON integers as floats (ErikMinekus#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wend4r authored Mar 17, 2022
1 parent aad596f commit 568dc1b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions json_natives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ static cell_t GetObjectFloatValue(IPluginContext *pContext, const cell_t *params
return pContext->ThrowNativeError("Could not retrieve value for key '%s'", key);
}

return sp_ftoc(static_cast<float>(json_real_value(value)));
return sp_ftoc(static_cast<float>(json_number_value(value)));
}

static cell_t GetObjectIntValue(IPluginContext *pContext, const cell_t *params)
Expand Down Expand Up @@ -537,7 +537,7 @@ static cell_t GetArrayFloatValue(IPluginContext *pContext, const cell_t *params)
return pContext->ThrowNativeError("Could not retrieve value at index %d", index);
}

return sp_ftoc(static_cast<float>(json_real_value(value)));
return sp_ftoc(static_cast<float>(json_number_value(value)));
}

static cell_t GetArrayIntValue(IPluginContext *pContext, const cell_t *params)
Expand Down

0 comments on commit 568dc1b

Please sign in to comment.