Due to the minimalist nature of Lua, the standard library for string does not contain commonly used methods like split. However, the module string_ext contains them. Below is a snippet on how to use the split method. The point to consider here is the module we have to import in order for the method to work correctly. Importing only the string_ext module is not enough. We have to import list and strbuf modules as well.

require("string_ext")
require("list")
require("strbuf")
print(string.split("Hello World", " ")) -- outputs {1=Hello,2=World}