serialization functions naming update
This commit is contained in:
parent
7f58a38454
commit
fdd9ede9d5
@ -78,7 +78,7 @@ file.mkdirs(путь: str) -> bool
|
||||
Библиотека содержит функции для сериализации и десериализации таблиц:
|
||||
|
||||
```python
|
||||
json.stringify(object: table, human_readable: bool=false) -> str
|
||||
json.tostring(object: table, human_readable: bool=false) -> str
|
||||
```
|
||||
|
||||
Сериализует объект в JSON строку. При значении второго параметра **true** будет использовано многострочное форматирование, удобное для чтения человеком, а не компактное, использующееся по-умолчанию.
|
||||
@ -94,7 +94,7 @@ json.parse(code: str) -> table
|
||||
Библиотека содержит функции для сериализации и десериализации таблиц:
|
||||
|
||||
```python
|
||||
toml.stringify(object: table) -> str
|
||||
toml.tostring(object: table) -> str
|
||||
```
|
||||
|
||||
Сериализует объект в TOML строку.
|
||||
|
||||
@ -302,3 +302,5 @@ get_block_rotation = block.get_rotation
|
||||
set_block_rotation = block.set_rotation
|
||||
get_block_user_bits = block.get_user_bits
|
||||
set_block_user_bits = block.set_user_bits
|
||||
toml.serialize = toml.tostring
|
||||
toml.deserialize = toml.parse
|
||||
|
||||
@ -23,14 +23,14 @@ static int l_json_stringify(lua_State* L) {
|
||||
}
|
||||
|
||||
static int l_json_parse(lua_State* L) {
|
||||
auto string = lua_tostring(L, 1);
|
||||
auto string = scripting::state->requireString(1);
|
||||
auto element = json::parse("<string>", string);
|
||||
scripting::state->pushvalue(element);
|
||||
return 1;
|
||||
}
|
||||
|
||||
const luaL_Reg jsonlib [] = {
|
||||
{"stringify", lua_wrap_errors<l_json_stringify>},
|
||||
{"tostring", lua_wrap_errors<l_json_stringify>},
|
||||
{"parse", lua_wrap_errors<l_json_parse>},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
@ -31,7 +31,7 @@ static int l_toml_parse(lua_State*) {
|
||||
}
|
||||
|
||||
const luaL_Reg tomllib [] = {
|
||||
{"serialize", lua_wrap_errors<l_toml_stringify>},
|
||||
{"deserialize", lua_wrap_errors<l_toml_parse>},
|
||||
{"tostring", lua_wrap_errors<l_toml_stringify>},
|
||||
{"parse", lua_wrap_errors<l_toml_parse>},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user