Skip to content

depilz/LuaLiveEdit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Solar2D - LiveEdit

Enhance your development process with LiveEdit, a dynamic tool that allows for real-time editing of variables and objects in Solar2D projects. This capability streamlines the development and debugging process by enabling on-the-fly adjustments.

Installation

  1. Download: Obtain the LiveEdit.lua and the edit.lua files from this repository.

  2. Add to Project: Incorporate the file into your Solar2D project.

  3. Include in Code: Import LiveEdit.lua in your main.lua or in other Lua files where debugging is required.

    require("LiveEdit")

Usage

There is two ways to use LiveEdit:

  1. Selecting target: Select the object you want to edit by shift scrolling over it. The target object will be highlighted inside a rectangle with its name on the top. You can then edit the object's properties in edit.lua or just move it around with the mouse.

  2. LiveEdit Function: Insert the following line at the desired points in your code to live stream the variables and manipulate them in real-time.

liveEdit(fn)
  • fn (function): A callback function that allows you to manipulate variables live as the application runs.

How it Works

When you activate LiveEdit, you can modify the attributes of existing variables on-the-fly. However, remember that the scope of variables is predetermined once the file is loaded; you cannot introduce new variables within the liveEdit context.

Important: Changes made via LiveEdit accumulate, so continuous adjustments like transitions must be managed carefully to avoid unintended behavior (e.g., make sure to stop a transition before initiating another).

Example Usage

local circle = display.newCircle(100, 100, 10)
circle:setFillColor(1, 0, 0)
transition.loop(circle, {
    time       = 1000,
    x          = 200,
    iterations = 0,
    transition = easing.inOutSine,
})


liveEdit(function()
    circle.y = math.random(100, 300) -- change the position
    circle:setFillColor(math.random(), math.random(), math.random()) -- change the color
end)

Ownership and License

Creator: Depilz
Company: Studycat Limited
This tool is distributed as open-source under the MIT License, allowing for modification and redistribution. We encourage enhancements and would love to see how you adapt it for your needs.

About

Lua live edit tool designed for Solar2D

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages