'luac: main.lua:170: 'end' expected (to close 'function' at line 150) near <eof>

hours and im still searching for the missing end in this code !

if ( arg[1] == "-rv" and arg[2] == "--generator" )
    then
        print("Please give your ip address (If your attack is local give your local address else give your public ip)")
        io.write("->: ")
        ip   = io.read()
        print("Please provide a port number")
        io.write("->: ")
        port = io.read()
        print("What you name you want to give to the reverse shell (Make sure you add .php at the end)")
        io.write("->: ")
        path = io.read()
        os.execute("sed -i \'49s/.*/$ip = " .. "'" .. ip .. "'" .. ";/\' reverse_shells/php-reverse-shell.php && " .. " sed -i \'50s/.*/$port = " .. "'" .. port .. "'" .. ";/\' reverse_shells/php-reverse-shell.php && cat reverse_shells/php-reverse-shell.php > " .. path)
        print("[:)] Done!")
        print("[*] Saved to " .. path )
    end
function cms_detect()

As i said i tried searching for end 2 times and removed/added tabs but still can't find it!



Solution 1:[1]

Ok it's my fault for not adding end inside the function

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Bugalpha