Search code examples
luaconsole

I've been learning LUA and want to clear console


I've been tiring to clear my console to make it neater, I've tried os.execute("clear") (which is similar to what I use in python) this is the whole program:

    while( true )
    do
        local opacity
        print("What do you want the opacity to be? (invisible is 1, solid is 0)")
        opacity = io.read()
        opacity = tonumber(opacity)
        if opacity >1 then
            print("Thats not correct, try again")
            os.execute("clear")
            elseif opacity <=1 then
            print(opacity)
        end
    end

SOLUTION HAS BEEN FOUND: require = os needed to be added for the os commands to work


Solution

  • On Windows:

    os.execute("cls")
    

    On Unix:

    os.execute("clear")