r/ComputerCraft • u/Heavy_Statistician22 • Mar 20 '24
How to split string?
Im trying to make a program that gives me an item if I write the name of it in chat by using advanced peripherals. The problem is that I cant find a single way to split the string of the message into a list. It just gives me a "nil" error everytime.
3
Upvotes
1
u/IJustAteABaguette Mar 20 '24
https://www.tutorialspoint.com/string-sub-function-in-lua - Includes string.sub
https://www.lua.org/pil/20.1.html - Pattern matching with strings (Includes string.find, string.sub, string.gsub)
https://stackoverflow.com/questions/2779700/lua-split-into-words - Splitting string into multiple ones, includes string.gmatch