diff options
author | Lars Müller <34514239+appgurueu@users.noreply.github.com> | 2022-02-22 19:17:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-22 19:17:08 +0100 |
commit | 0a0fb11c218cf6c9ac419a8b4fda759fa3ed96e1 (patch) | |
tree | d74d35f925935fb5cba17d427f49b3e708930371 | |
parent | c31b3017222edd6e93bdeb02f05a3df7b6b23a1a (diff) | |
download | minetest-0a0fb11c218cf6c9ac419a8b4fda759fa3ed96e1.tar.gz minetest-0a0fb11c218cf6c9ac419a8b4fda759fa3ed96e1.tar.bz2 minetest-0a0fb11c218cf6c9ac419a8b4fda759fa3ed96e1.zip |
Lua API: Consistently use double vs. single quotes (#12075)
-rw-r--r-- | doc/lua_api.txt | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 23408ff6c..543f00542 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -1683,10 +1683,10 @@ wear value. Syntax: Examples: -* `'default:apple'`: 1 apple -* `'default:dirt 5'`: 5 dirt -* `'default:pick_stone'`: a new stone pickaxe -* `'default:pick_wood 1 21323'`: a wooden pickaxe, ca. 1/3 worn out +* `"default:apple"`: 1 apple +* `"default:dirt 5"`: 5 dirt +* `"default:pick_stone"`: a new stone pickaxe +* `"default:pick_wood 1 21323"`: a wooden pickaxe, ca. 1/3 worn out ### Table format @@ -1776,21 +1776,21 @@ Groups in crafting recipes An example: Make meat soup from any meat, any water and any bowl: { - output = 'food:meat_soup_raw', + output = "food:meat_soup_raw", recipe = { - {'group:meat'}, - {'group:water'}, - {'group:bowl'}, + {"group:meat"}, + {"group:water"}, + {"group:bowl"}, }, - -- preserve = {'group:bowl'}, -- Not implemented yet (TODO) + -- preserve = {"group:bowl"}, -- Not implemented yet (TODO) } Another example: Make red wool from white wool and red dye: { - type = 'shapeless', - output = 'wool:red', - recipe = {'wool:white', 'group:dye,basecolor_red'}, + type = "shapeless", + output = "wool:red", + recipe = {"wool:white", "group:dye,basecolor_red"}, } Special groups @@ -5982,11 +5982,11 @@ Misc. This is due to the fact that JSON has two distinct array and object values. * Example: `write_json({10, {a = false}})`, - returns `"[10, {\"a\": false}]"` + returns `'[10, {"a": false}]'` * `minetest.serialize(table)`: returns a string * Convert a table containing tables, strings, numbers, booleans and `nil`s into string form readable by `minetest.deserialize` - * Example: `serialize({foo='bar'})`, returns `'return { ["foo"] = "bar" }'` + * Example: `serialize({foo="bar"})`, returns `'return { ["foo"] = "bar" }'` * `minetest.deserialize(string[, safe])`: returns a table * Convert a string returned by `minetest.serialize` into a table * `string` is loaded in an empty sandbox environment. @@ -5998,7 +5998,7 @@ Misc. value of `safe`. It is fine to serialize then deserialize user-provided data, but directly providing user input to deserialize is always unsafe. * Example: `deserialize('return { ["foo"] = "bar" }')`, - returns `{foo='bar'}` + returns `{foo="bar"}` * Example: `deserialize('print("foo")')`, returns `nil` (function call fails), returns `error:[string "print("foo")"]:1: attempt to call global 'print' (a nil value)` @@ -8091,11 +8091,11 @@ Used by `minetest.register_craft`. ### Shaped { - output = 'default:pick_stone', + output = "default:pick_stone", recipe = { - {'default:cobble', 'default:cobble', 'default:cobble'}, - {'', 'default:stick', ''}, - {'', 'default:stick', ''}, -- Also groups; e.g. 'group:crumbly' + {"default:cobble", "default:cobble", "default:cobble"}, + {"", "default:stick", ""}, + {"", "default:stick", ""}, -- Also groups; e.g. "group:crumbly" }, replacements = <list of item pairs>, -- replacements: replace one input item with another item on crafting @@ -8106,7 +8106,7 @@ Used by `minetest.register_craft`. { type = "shapeless", - output = 'mushrooms:mushroom_stew', + output = "mushrooms:mushroom_stew", recipe = { "mushrooms:bowl", "mushrooms:mushroom_brown", |