diff options
Diffstat (limited to '')
| -rw-r--r-- | lua_json.c | 13 |
1 files changed, 8 insertions, 5 deletions
| @@ -262,9 +262,10 @@ char *lua_json_encode(lua_State *l, int *len) | |||
| 262 | return json; | 262 | return json; |
| 263 | } | 263 | } |
| 264 | 264 | ||
| 265 | /* lua_c_json_encode(object) must be called via lua_pcall(). | 265 | /* lua_json_pcall_encode(object) must be called via lua_pcall(). |
| 266 | * It can be used to catch any encoder exceptions */ | 266 | * This allows a C caller to catch any errors without needing |
| 267 | int lua_c_json_encode(lua_State *l) | 267 | * to register the string with Lua for garbage collection. */ |
| 268 | int lua_json_pcall_encode(lua_State *l) | ||
| 268 | { | 269 | { |
| 269 | char *json; | 270 | char *json; |
| 270 | int len; | 271 | int len; |
| @@ -666,8 +667,10 @@ void lua_json_decode(lua_State *l, const char *json_text) | |||
| 666 | strbuf_free(json.tmp); | 667 | strbuf_free(json.tmp); |
| 667 | } | 668 | } |
| 668 | 669 | ||
| 669 | /* lua_c_json_decode(string) must be called from C with lua_pcall() */ | 670 | /* lua_json_pcall_decode(string) must be called via lua_pcall(). |
| 670 | int lua_c_json_decode(lua_State *l) | 671 | * This allows a C caller to catch any errors so the string can |
| 672 | * be freed before returning to Lua. */ | ||
| 673 | int lua_json_pcall_decode(lua_State *l) | ||
| 671 | { | 674 | { |
| 672 | const char *json; | 675 | const char *json; |
| 673 | 676 | ||
