Author Topic: [Beta] [1.2.1] LuaBee - Lua scripting engine for MusicBee  (Read 501 times)

DJ MADEST

  • Newbie
  • *
  • Posts: 7
Hello! I am developing a plugin that allows you to load Lua scripts, thereby expanding the functionality of the player. The advantages of this approach are obvious - the simplicity and speed of development. Of course, at the current stage of development, scripts cannot replace plugins, but writing simple automation algorithms is much simpler on scripts than on plug-ins.

Warning: This plugin is under development, global API changes and random crashes are inevitable.


Documentation is under construction at: https://lainez.gitbook.io/luabee/
Download (v 1.2.1): Download


------
Simple script example

Code
-- Very simple example: Pauses the track if volume level in player is 0


-- Some variables
-- in Lua it is common to use local variables
local EVENT_VOLUMECHANGE = 6 -- Volume change event ID
local volLoop = false -- prevent looping =)


-- Callbacks
function ReceiveNotification(source, event)
    if event == EVENT_VOLUMECHANGE then
        local volume = GetVolume() -- gets volume level
        if volume == 0 then
            SetPlayState("playpause") -- set playing state
            volLoop = true -- prevent looping
        end
        if volume > 0 and volLoop then
            SetPlayState("playpause") -- set playing state
            volLoop = false
        end
    end
end
Last Edit: May 22, 2019, 06:20:20 PM by DJ MADEST

DJ MADEST

  • Newbie
  • *
  • Posts: 7
Version 1.1.1

Scripts manager:

+ 2 new buttons - "Lookup new scripts" and "Open scripts folder"

API Changes:

+ SetAutoDJ()
+ MbUI:AllocalateConsole()
+ MbUI:PrintConsole()

Description for new functions you can find on docs
Last Edit: May 22, 2019, 06:21:26 PM by DJ MADEST

DJ MADEST

  • Newbie
  • *
  • Posts: 7
Version 1.2.1

API Changes:

+ CreatePlaylist
+ PlaylistSetFiles
+ RemoveFileFromPlaylist
+ RemovePlaylist

Fixed bug with ReceiveNotification when the event argument were not valid for Lua datatype

Description for new functions you can find on docs

zkhcohen

  • Full Member
  • ***
  • Posts: 243
Hey! This seems like a really cool project.

I'm used to creating add-ins in C# - could you provide some sample projects in lua?

DJ MADEST

  • Newbie
  • *
  • Posts: 7
Hey! This seems like a really cool project.

I'm used to creating add-ins in C# - could you provide some sample projects in lua?
Yes, i'm working on it...