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