-
Notifications
You must be signed in to change notification settings - Fork 207
Hot Reload
Lua Native's IDEA plugin experience version is coming ~
In order to reduce the tedious steps of debugging Lua, LuaNative plug-in is provided as a simple and fast lua debugging tool.
- Download LuaNative (Note: Note that the zip package can be installed correctly)
- Open IDEA and select Preferences-> plugins-> Settings -> Install Plugin from Disk. Choose Step 1 to download the zip package. After installation, the newly added Lua Native plugin will be displayed under the Installed tab. Then restart IDEA.
- The installation is successful. After restarting IDEA, we will find that there is an extra column of LuaNative at the bottom control panel. The related operations are performed in this panel.
- Cloning MLN code scanning project
git clone https://github.com/momotech/MLN
- iOS code scanning package
Find the
MLN-iOS/Example/MLN.xcworkspace
directory, open it in Xcode, run it and install it on your phone.
- Android scan code package
Find the
MLN-Android
directory, open it in Android Studio, run it and install it on your phone.
- When you open the scan code package, you will see the "hot reload" button. After you click the button to enter the hot reload interface, a lua logo will be displayed. Click the logo to display the two-dimensional code scanning button and the port number setting button. The code button can be connected to the LuaNative plug-in via WIFI, and the port number set must be consistent with the port number set in the PC-side plug-in.
Devices Info provides two ways to connect devices: USB and WIFI.
-
USB connection
1)Connect your mobile phone to your computer via a data cable;
2)Select the connected mobile phone in the "Devices Info" list;
3)The connection shown below indicates a successful connection
-
WIFI connection
1)Click the "Refresh Local QR Code" button in the LuaNative plugin, a QR code will appear;
2)Click the lua logo on the mobile phone, and then click the QR code button to scan the QR code in the above plugin;
3)The connection shown below indicates a successful connection
Note: WIFI connection needs to ensure that the PC and the device are in the same LAN.
- 1.Right-click the lua file you want to debug-> Mark as Entry File to set the current lua file as the entry. (Cancel the entry, also right-click UnMark as Entry File)
-!!! The project must have a src directory and only lua files under src can be used as entry files.
-
2.After setting the entry, the corresponding entry file will be added to the Entry File in the control panel. Select the corresponding lua entry in the Entry File and click refresh. The hot reload interface on the mobile phone will display the contents of the lua entry file. If the "Auto Sync" function is turned on, the content of the lua file is modified, and the hot-reload interface on the mobile phone will be updated synchronously; if the "Auto Sync" is turned off, you need to click the "Refresh" button in the plugin to update the mobile phone interface.
-
3.Parameters provides lua parameter passing, which simulates the parameter passing when the page jumps. For example, enter "key = 123" in Parameters, and then edit the following code in our lua entry file to get the corresponding key value.
window:getExtra():get("key")
- 4.Set the port number Connection Port. When the port number is occupied and the USB cannot be connected, you can modify the port numbers on the PC side and the mobile phone side and keep the same to connect successfully.
- Verbose: Provide all log information, including Log and Error information; Log provides print information; Error provides error information.
- Keyword search in the edit box on the right side of the log type, you can press enter to quickly change to the next one.
- Error messages will be marked in red. Click on the blue highlight to quickly locate the error location.
- The character string set by the filter should be filtered from the beginning of the print message. (Figure: The filter can be successfully filtered by entering "window: getE", and entering "dow: getE" cannot filter out that information)
- USB port occupation
- Here you need to modify the port of the plug-in on the mobile phone and PC, and keep the same
- Long time background, iOS or Android may lose connection
- If it is USB, just re-open it
- In wifi mode, re-scan the code connection or restart the scan package
- If an error such as AndroidStudioProfile is prompted, close as first, and then run as again after the plug-in connection is successful. The reason is that AndroidStudio sometimes occupies adb, causing the plug-in USB connection to fail.
- Scan code cannot be connected
- It is necessary to check whether the PC and mobile phones are on the same network
- Check if VPN is connected, you need to disconnect VPN to connect
Questions or bad experiences during use, welcome feedback ~