m-lua-scripting: always parse JSON to String if its type is not recognized
This allows parsing JSON strings without quotes.
This commit is contained in:
@@ -123,13 +123,6 @@ push_luajson (lua_State *L, WpSpaJson *json)
|
||||
lua_pushnumber (L, value);
|
||||
}
|
||||
|
||||
/* String */
|
||||
else if (wp_spa_json_is_string (json)) {
|
||||
g_autofree gchar *value = wp_spa_json_parse_string (json);
|
||||
g_warn_if_fail (value);
|
||||
lua_pushstring (L, value);
|
||||
}
|
||||
|
||||
/* Array */
|
||||
else if (wp_spa_json_is_array (json)) {
|
||||
g_auto (GValue) item = G_VALUE_INIT;
|
||||
@@ -163,6 +156,13 @@ push_luajson (lua_State *L, WpSpaJson *json)
|
||||
lua_setfield (L, -2, key_str);
|
||||
}
|
||||
}
|
||||
|
||||
/* Otherwise alwyas parse as String to allow parsing strings without quotes */
|
||||
else {
|
||||
g_autofree gchar *value = wp_spa_json_parse_string (json);
|
||||
g_warn_if_fail (value);
|
||||
lua_pushstring (L, value);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
|
Reference in New Issue
Block a user