-
Notifications
You must be signed in to change notification settings - Fork 164
Extending mpv and mpv.net via Lua scripting
stax76 edited this page Jun 14, 2022
·
8 revisions
Learn what Lua is in 100 seconds here.
Lua scripting is documented in the mpv manual here.
A very large collection of user scripts can be found in the mpv wiki here.
On GitHub, mpv scripts are tagged as mpv-script.
In Visual Studio Code install:
The debugger works when the code is error free, if there is a Lua error the debugger exits at the error location without giving a trace or hint about the error. The debugger allows stepping through code, watch variables and table contents.
In your debug configuration defined in launch.json you can use 3 profiles:
- Lua without mpv using VS Code terminal output and debugging.
- Debugging with mpv.exe, you have to compile a mpv debug build, which is described here and here.
- Show mpv and Lua errors via external terminal output from mpv.com.
{
"version": "0.2.0",
"configurations": [
{
"name": "lua",
"program": "${file}",
"request": "launch",
"console": "integratedTerminal",
"stopOnEntry": false,
"type": "lua"
},
{
"type": "lua",
"request": "launch",
"name": "mpv lua",
"console": "internalConsole",
"runtimeExecutable": "D:/Software/Development/MSYS2/mingw64/bin/mpv.exe",
"runtimeArgs": ["--quiet", "--script=${file}", "D:/Samples/LG New York HDR UHD 4K Demo.mkv"],
"stopOnEntry": false,
"luaVersion": "5.1"
},
{
"type": "lua",
"request": "launch",
"name": "mpv lua term",
"console": "externalTerminal",
"runtimeExecutable": "D:/Software/Development/MSYS2/mingw64/bin/mpv.com",
"runtimeArgs": ["--quiet", "--script=${file}", "D:/Samples/LG New York HDR UHD 4K Demo.mkv"],
"stopOnEntry": false,
"luaVersion": "5.1"
}
]
}
To read resources in dark mode, there is Dark Reader.
- https://github.com/LewisJEllis/awesome-lua
- https://www.lua.org/manual/5.1/manual.html
- https://www.lua.org/manual/5.1/index.html#index
- http://lua-users.org/
- https://www.reddit.com/r/lua/
- https://github.com/uhub/awesome-lua
- http://kiki.to/blog/2014/03/30/a-guide-to-authoring-lua-modules/
- https://learnxinyminutes.com/docs/lua/
- https://www.tutorialspoint.com/lua
- https://www.wikiwand.com/en/Lua_(programming_language)
- https://www.newthinktank.com/2015/06/learn-lua-one-video/
- https://stevedonovan.github.io/lua-cookbook/topics/00-intro.md.html#
- https://en.m.wikibooks.org/wiki/Lua_Programming
- https://riptutorial.com/lua
- http://www.w3big.com/lua/default.html
- https://github.com/pohka/Lua-Beginners-Guide
- http://lua-users.org/wiki/LuaStyleGuide
- http://lua-users.org/wiki/TutorialDirectory
- http://notebook.kulchenko.com/programming/lua-good-different-bad-and-ugly-parts
- https://github.com/Olivine-Labs/lua-style-guide
- https://www.lua.org/pil/contents.html