Still have questions? Join our Discord server and get real time help.
Log in to vote

Is it possible to use alternatives in match tables? [Intermediate knowledge]

Asked by
Feahren 1586 Moderation Voter
5 months ago
Edited 5 months ago

I’m not sure if I correctly worded the question above, please let me know if so, but I’m trying to make a admin for my Chat, and I came across an issue, it’s even weirder to explain but I did write and example of where I’m getting at. The formation of the string mud looks like so ;Print:Console(Hi), ; is the Prefix, :Console Is the extension type; Usually each command would have different uses, they would be defined on :. The () are a classic parameter setup, just for fun I guess;) I’m not one to jump to conclusions but I believe in order to properly grasp this example below, you may need decent knowledge in Lua, or math.

local m = ";Print:Console(Hi)"
local p = [[;]]
local c = {
local cb = {
   ["Print"] = ":Console" or ":Hello()" --// my question, restricts to ":Console" only, better way to do this?
if (m:sub(1,1) == p) then
   if (m:sub(#p,#c[1]+1) == p..c[1]) then
      if (m:sub(#c[1]+2,#m-4) == cb[c[1]]) then pC = true
         if (pC) then
            mp = m:sub((#p+#c[1]+#cb[c[1]]+2), #m-1)
      elseif (m:sub(#c[1]+2,#m) == cb[c[1]]) then
         print("Hello World!")

Please help me out! it may be hard to understand all together so feel free to ask any questions at all!

I’m not sure about the formatting if able, so I presumed or

Answer this question