How do I clear the console in a Lua Program

前端 未结 4 956
梦如初夏
梦如初夏 2021-02-06 03:11

I\'m making my first Lua program with the console, and I need to find out how to remove all the text in the console without just appending a ton of \\n\'s.

4条回答
  •  太阳男子
    2021-02-06 03:28

    Sorry for the late answer, but if anyone check this post here's a way to do it :

    if not os.execute("clear") then
        os.execute("cls")
    elseif not os.execute("cls") then
        for i = 1,25 do
            print("\n\n")
        end
    end
    

    This will work on any os.

提交回复
热议问题