Implement the LUA Automatic Update script tutorial

Source: Internet
Author: User
Tags ftp lua

First, you need to automatically determine whether an update is needed and automatically download it from FTP if a new version is available. Obviously, we need a file to record the version number of the latest version and the files that need to be downloaded.

Like this, version is the latest version number, and filename is the file name of the file that needs to be downloaded.

Then, upload the necessary files to the server.

The necessary files include the version,txt of the record version update and the files that need to be downloaded for the updated version (take Newlua.lua for example)

Then, get the content in the Version.txt and decide if you want to update the code as follows:

Current_version is the version number of the current script, and the URL is the location of the version.txt.

Gets the version number and then compares it to the current version number, which is automatically updated if the current version number is lower than the latest version number.

Connect ftp and download updates automatically:

The file name that needs to be downloaded is matched by the contents of the Version,txt record, and the file is downloaded to the script directory via FTP (for example, iOS)

Script Run Effect:

Click the Refresh button in the upper right corner of the touch Wizard to find that the update is automatically downloaded:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.