Jump to content

Scripting GG/Lua in VScode : Tips and Tricks


mRonaldo
 Share

Recommended Posts

Note to Mods : Since I'm new here there I cannot create post other than here . If you find below guide useful please move to guide folder. 

 

I'm a newbie to Lua but interested to learn ( albeit at a slow pace ) .

The first thing I observed was to find a quick way to script and test. Now I've a windows on VM that I use to practice. Running bluestacks on VM is discouraged due to performance issue. So set up as below. It  can be used both in or out of VM.

 

Environment

  • Windows 10/11
  • Windows 10/11 VM

Apps

Setup

  • Install Lua binaries > Update path in environment variable 
  • Install ADB > Update path in environment variable 
  • Install VSCode
    •  Install extensions for Lua and GG Intellisense
    • Setup a default build task for .lua files 
    • CODE for default build task
    {
        // See https://go.microsoft.com/fwlink/?LinkId=733558
        // for the documentation about the tasks.json format
        "version": "2.0.0",
        "tasks": [
            {
                "label": "push2Phone",
                "type": "shell",
                "command": "adb push c:/dev/lua/lw_01.lua ./sdcard/lua/",  **** CHANGE THIS LINE AS PER YOUR PATH AND REMOVE COMMENT ****
                "problemMatcher": [],
                "group": {
                    "kind": "build",
                    "isDefault": true
                }
            }
        ]
    }

 

Prerequisites

  • Activate android debugging on phone and link your device via ADB 
  • [Optional] Download SCRCPY and run the application

How to use

  1. Create a script in VScode. 
  2. Use intellisense extension to format, check syntax errors etc
  3. Save
  4. Please CTRL + SHIFT + B > This will trigger default build and due to the code above will automatically push the script to desired folder on phone ( Provided the phone is already connected via adb ) 
  5. Use GG in phone/scrcpy to run the file.
  6. This is one quick way to develop + test directly on phone 

 

If you have any other tips/tricks related to vscode, feel free to add .

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.