How to dissect and parse a string in lua?

后端 未结 3 1514
南旧
南旧 2021-01-25 13:58

I am trying to make command arguments in Roblox. For example, /kill playername. The problem is I don\'t know how to parse the playername from the string /kill

3条回答
  •  悲哀的现实
    2021-01-25 14:44

    Use string.match:

    Message=" /kill playername  "
    command, arg = Message:match("%s*/(.-)%s+(.*)%s*$")
    

提交回复
热议问题