First working version
This commit is contained in:
33
config.lua
Normal file
33
config.lua
Normal file
@@ -0,0 +1,33 @@
|
||||
-- This file is licensed under the terms of the BSD 2-clause license.
|
||||
-- See LICENSE.txt for details.
|
||||
|
||||
matrix.config = {}
|
||||
|
||||
local function setting(stype, name, default, required)
|
||||
local value
|
||||
if stype == "bool" then
|
||||
value = minetest.setting_getbool("matrix."..name)
|
||||
elseif stype == "string" then
|
||||
value = minetest.setting_get("matrix."..name)
|
||||
elseif stype == "number" then
|
||||
value = tonumber(minetest.setting_get("matrix."..name))
|
||||
end
|
||||
if value == nil then
|
||||
if required then
|
||||
error("Required configuration option matrix."..
|
||||
name.." missing.")
|
||||
end
|
||||
value = default
|
||||
end
|
||||
matrix.config[name] = value
|
||||
end
|
||||
|
||||
-------------------------
|
||||
-- BASIC USER SETTINGS --
|
||||
-------------------------
|
||||
|
||||
setting("string", "user", nil, true) -- User name, fe @digbot:matrix.org
|
||||
setting("string", "server", nil, true) -- Server address to connect to
|
||||
setting("number", "port", 8448) -- Server port to connect to
|
||||
setting("string", "channel", nil, true) -- Channel to join (not needed?)
|
||||
setting("string", "password", nil, true) -- Server password
|
||||
Reference in New Issue
Block a user