From 5b2461c713889b9832f5b99c85abf87e5d494242 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Mon, 11 Sep 2017 16:25:20 +0200 Subject: Fix core.wrap_text and make its behaviour consistent with the docs Code based on initial implementation by @dsohler. --- doc/lua_api.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 03c825689..f0e6931db 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -2128,9 +2128,11 @@ Helper functions * e.g. `string:split("a,b", ",") == {"a","b"}` * `string:trim()` * e.g. `string.trim("\n \t\tfoo bar\t ") == "foo bar"` -* `minetest.wrap_text(str, limit)`: returns a string - * Adds new lines to the string to keep it within the specified character limit +* `minetest.wrap_text(str, limit, [as_table])`: returns a string or table + * Adds newlines to the string to keep it within the specified character limit + Note that returned lines may be longer than the limit since it only splits at word borders. * limit: Maximal amount of characters in one line + * as_table: optional, if true return table of lines instead of string * `minetest.pos_to_string({x=X,y=Y,z=Z}, decimal_places))`: returns string `"(X,Y,Z)"` * Convert position to a printable string Optional: 'decimal_places' will round the x, y and z of the pos to the given decimal place. -- cgit v1.2.3