diff --git a/README.md b/README.md index cb5592b..bd34717 100644 --- a/README.md +++ b/README.md @@ -133,6 +133,31 @@ Currently, there is no editor autocompletion/integration support for most editor [third-party autocompletion support](https://github.com/Rabios/raylua/tree/master/zerobrane) for [ZeroBrane Studio](https://studio.zerobrane.com/) by [Rabios](https://github.com/Rabios). +#### Debugging + +You can use [Local Lua Debugger for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=tomblind.local-lua-debugger-vscode) +to provide debugging support with Visual Studio Code. +You need to add this at the beginning of your code to use it : +```lua +do local f = getmetatable(rl).__index;rawset(rl, "__index", function (_, k) return select(2, pcall(f, _, k)) end) end +package.path = package.path .. os.getenv "LUA_PATH" +local lldebugger = require "lldebugger"; lldebugger.start() +``` +You also need to setup a launch configuration in Visual Studio Code to run raylua_s with debugger attached, e.g +```json +{ + "type": "lua-local", + "request": "launch", + "name": "(Lua) Launch", + "cwd": "${workspaceFolder}", + "program": { "command": "PATH TO raylua_s" }, + "args": [ "main.lua OR ${file} OR WHATEVER" ] +} +``` +This debugger doesn't support pausing, you need to place a breakpoint before executing +to get a actual debug, otherwise, a error needs to be thrown in the application to get the debugging. +This debugger has a significant overhead, expect a performance loss in intensive projects. + ### Other bindings raylib-lua (raylua) is not the only Lua binding for raylib. diff --git a/examples/core_basic_window.lua b/examples/core_basic_window.lua index e58cb14..cac157d 100644 --- a/examples/core_basic_window.lua +++ b/examples/core_basic_window.lua @@ -3,12 +3,12 @@ rl.SetConfigFlags(rl.FLAG_VSYNC_HINT) rl.InitWindow(800, 450, "raylib [core] example - basic window") while not rl.WindowShouldClose() do - rl.BeginDrawing() + rl.BeginDrawing() - rl.ClearBackground(rl.RAYWHITE) - rl.DrawText("Congrats! You created your first window!", 190, 200, 20, rl.LIGHTGRAY) + rl.ClearBackground(rl.RAYWHITE) + rl.DrawText("Congrats! You created your first window!", 190, 200, 20, rl.LIGHTGRAY) - rl.EndDrawing() + rl.EndDrawing() end rl.CloseWindow() diff --git a/examples/shapes_logo_raylib.lua b/examples/shapes_logo_raylib.lua index 61c344d..e64f24a 100644 --- a/examples/shapes_logo_raylib.lua +++ b/examples/shapes_logo_raylib.lua @@ -17,7 +17,7 @@ while not rl.WindowShouldClose() do rl.DrawText("this is NOT a texture!", 350, 370, 10, rl.GRAY) - rl.EndDrawing() + rl.EndDrawing() end -rl.CloseWindow() +rl.CloseWindow() \ No newline at end of file