1
0
mirror of https://github.com/janet-lang/janet synced 2024-09-28 23:10:40 +00:00

Merge pull request #963 from uvtc/patch-8

table.c docstrings
This commit is contained in:
Calvin Rose 2022-04-18 14:07:26 -05:00 committed by GitHub
commit 04ace9fc16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -296,8 +296,8 @@ JanetTable *janet_table_proto_flatten(JanetTable *t) {
JANET_CORE_FN(cfun_table_new, JANET_CORE_FN(cfun_table_new,
"(table/new capacity)", "(table/new capacity)",
"Creates a new empty table with pre-allocated memory " "Creates a new empty table with pre-allocated memory "
"for capacity entries. This means that if one knows the number of " "for `capacity` entries. This means that if one knows the number of "
"entries going to go in a table on creation, extra memory allocation " "entries going into a table on creation, extra memory allocation "
"can be avoided. Returns the new table.") { "can be avoided. Returns the new table.") {
janet_fixarity(argc, 1); janet_fixarity(argc, 1);
int32_t cap = janet_getinteger(argv, 0); int32_t cap = janet_getinteger(argv, 0);
@ -306,7 +306,7 @@ JANET_CORE_FN(cfun_table_new,
JANET_CORE_FN(cfun_table_getproto, JANET_CORE_FN(cfun_table_getproto,
"(table/getproto tab)", "(table/getproto tab)",
"Get the prototype table of a table. Returns nil if a table " "Get the prototype table of a table. Returns nil if the table "
"has no prototype, otherwise returns the prototype.") { "has no prototype, otherwise returns the prototype.") {
janet_fixarity(argc, 1); janet_fixarity(argc, 1);
JanetTable *t = janet_gettable(argv, 0); JanetTable *t = janet_gettable(argv, 0);
@ -317,7 +317,7 @@ JANET_CORE_FN(cfun_table_getproto,
JANET_CORE_FN(cfun_table_setproto, JANET_CORE_FN(cfun_table_setproto,
"(table/setproto tab proto)", "(table/setproto tab proto)",
"Set the prototype of a table. Returns the original table tab.") { "Set the prototype of a table. Returns the original table `tab`.") {
janet_fixarity(argc, 2); janet_fixarity(argc, 2);
JanetTable *table = janet_gettable(argv, 0); JanetTable *table = janet_gettable(argv, 0);
JanetTable *proto = NULL; JanetTable *proto = NULL;
@ -339,8 +339,8 @@ JANET_CORE_FN(cfun_table_tostruct,
JANET_CORE_FN(cfun_table_rawget, JANET_CORE_FN(cfun_table_rawget,
"(table/rawget tab key)", "(table/rawget tab key)",
"Gets a value from a table without looking at the prototype table. " "Gets a value from a table `tab` without looking at the prototype table. "
"If a table tab does not contain t directly, the function will return " "If `tab` does not contain the key directly, the function will return "
"nil without checking the prototype. Returns the value in the table.") { "nil without checking the prototype. Returns the value in the table.") {
janet_fixarity(argc, 2); janet_fixarity(argc, 2);
JanetTable *table = janet_gettable(argv, 0); JanetTable *table = janet_gettable(argv, 0);