Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
local chat = { commands = {} } function chat.newCommand(commandName, commandFunction) chat.commands[commandName] = { name = commandName, commandFunction = commandFunction, subCommands = {} } local lastSpace local spacePos repeat lastSpace = spacePos spacePos = commandName:find("%s", (lastSpace or -1) + 1) until not spacePos if lastSpace then chat.commands[commandName].superCommand = chat.commands[commandName:sub(1, lastSpace - 1)] table.insert(chat.commands[commandName].superCommand.subCommands, chat.commands[commandName]) end end local function printCommands(commands, position, dontPrintChilds) position = position or 0 for k,command in pairs(commands) do if not (command.superCommand and dontPrintChilds) then print(string.rep(" ", position) .. command.name) end printCommands(command.subCommands, position + 2) end end local function help() printCommands(chat.commands, 0, true) end chat.newCommand("test") chat.newCommand("test blub") chat.newCommand("aha") chat.newCommand("aha tada") chat.newCommand("aha nein") chat.newCommand("aha nein blub") help()
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)