/ example.lua
example.lua
 1  local _ps = player_settings
 2  local S = minetest.get_translator("player_settings")
 3  
 4  _ps.register_metacategory("ps_example_mc",{
 5      title = S("Settings Examples MC"),
 6  })
 7  
 8  _ps.register_category("ps_example",{
 9      title = S("Settings Examples"),
10      metacategory = "ps_example_mc"
11  })
12  
13  _ps.register_setting("ps_example_int", {
14      type = "int",
15      description = S("Example of @1", "int"),
16      long_description = S("Long description. \nExample of @1","int"),
17      default = 1,
18      category = "ps_example",
19  })
20  
21  _ps.register_setting("ps_example_float", {
22      type = "float",
23      description = S("Example of @1", "float"),
24      long_description = S("Long description. \nExample of @1","float"),
25      default = 1.2345,
26      category = "ps_example",
27  })
28  
29  _ps.register_setting("ps_example_string", {
30      type = "string",
31      description = S("Example of @1", "string"),
32      long_description = S("Long description. \nExample of @1","string"),
33      default = "DEFAULT",
34      category = "ps_example",
35  })
36  
37  _ps.register_setting("ps_example_bool", {
38      type = "bool",
39      description = S("Example of @1", "bool"),
40      long_description = S("Long description. \nExample of @1","bool"),
41      default = true,
42      category = "ps_example",
43  })
44  
45  _ps.register_setting("ps_example_enum_string", {
46      type = "enum",
47      description = S("Example of @1", "enum (string)"),
48      long_description = S("Long description. \nExample of @1","enum (string)"),
49      default = "1F616EMO",
50      category = "ps_example",
51      enum_type = "string",
52      enum_choices = {
53          "lorem",
54          "ipsum",
55          "hello",
56          "world",
57          "minetest",
58          "1F616EMO",
59      }
60  })
61  
62  _ps.register_category("ps_example_empty",{
63      title = S("Empty Examples"),
64      metacategory = "ps_example_mc"
65  })