changed minetest chat function regchat to create command_list table
This commit is contained in:
parent
ebfd270b25
commit
f255a057e5
@ -4,13 +4,19 @@
|
|||||||
|
|
||||||
local chat_table -- MT chat command definitions table
|
local chat_table -- MT chat command definitions table
|
||||||
local regchat -- Chat-command registration function
|
local regchat -- Chat-command registration function
|
||||||
|
local command_list -- user-facing list of commands
|
||||||
|
|
||||||
regchat = minetest.register_chatcommand
|
regchat = minetest.register_chatcommand
|
||||||
|
|
||||||
|
regchat = function(name, command_table)
|
||||||
|
minetest.register_chatcommand(name, command_table)
|
||||||
|
table.insert(command_list, name)
|
||||||
|
end
|
||||||
|
|
||||||
-- ===================================================================
|
-- ===================================================================
|
||||||
-- /menu
|
-- /menu
|
||||||
-- Presents a menu of options to users
|
-- Presents a menu of options to users
|
||||||
minetest.register_chatcommand(
|
regchat(
|
||||||
"menu", {
|
"menu", {
|
||||||
privs = {},
|
privs = {},
|
||||||
func = function(user)
|
func = function(user)
|
||||||
@ -56,7 +62,7 @@ regchat ("list_orgs" , chat_table)
|
|||||||
|
|
||||||
-- ===================================================================
|
-- ===================================================================
|
||||||
-- /listplayers
|
-- /listplayers
|
||||||
minetest.register_chatcommand(
|
regchat(
|
||||||
"listplayers", {
|
"listplayers", {
|
||||||
privs = {},
|
privs = {},
|
||||||
func = function(user)
|
func = function(user)
|
||||||
@ -67,7 +73,7 @@ minetest.register_chatcommand(
|
|||||||
|
|
||||||
-- ===================================================================
|
-- ===================================================================
|
||||||
-- /joinorg
|
-- /joinorg
|
||||||
minetest.register_chatcommand(
|
regchat(
|
||||||
"joinorg", {
|
"joinorg", {
|
||||||
privs = {},
|
privs = {},
|
||||||
func = function(user, param)
|
func = function(user, param)
|
||||||
@ -81,7 +87,7 @@ minetest.register_chatcommand(
|
|||||||
-- ===================================================================
|
-- ===================================================================
|
||||||
-- /pollself [question]
|
-- /pollself [question]
|
||||||
-- asks the user a question specified in param
|
-- asks the user a question specified in param
|
||||||
minetest.register_chatcommand(
|
regchat(
|
||||||
"pollself", {
|
"pollself", {
|
||||||
privs = {},
|
privs = {},
|
||||||
func = function(user, param)
|
func = function(user, param)
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
-- TKTK currently a manually curated list---needs major improvement
|
-- TKTK currently a manually curated list---needs major improvement
|
||||||
modpol.menu = function(user)
|
modpol.menu = function(user)
|
||||||
local output = "Command list:"
|
local output = "Command list:"
|
||||||
for key,value in pairs(chat_table) do
|
for key,value in pairs(command_list) do
|
||||||
output = output .. "/" .. key .. "\n"
|
output = output .. "/" .. key .. "\n"
|
||||||
end
|
end
|
||||||
return output
|
return output
|
||||||
|
Loading…
x
Reference in New Issue
Block a user