Adding SDL2 with Lua bindings to an existing program?

I’m trying to make a game in an engine called Leadwerks, but it doesn’t have any way of utilizing controller input. I thought about including XInput, but from what I can gather, there’s limitations on it, and would rather just have the additional content from SDL. The Engine is made with C++, and uses Lua 5.1, and you can code in both, but the level editor uses Lua based entities, so I’d like to add the bindings so I can have C++ handle the lower level functions, while Lua handles the higher level functions. The problem is, I’m still pretty inexperienced with programming, as most of my experience came from visual scripting in Unreal, and I don’t know where to start with understanding how this stuff works. I just want to add SDL2 to the existing engine, and then add the Lua bindings so I can finally get started with actually doing what I want. Any help at all would be appreciated.

I haven’t used it, but this might be helpful:
Tangent128/luasdl2: A pure C binding of SDL 2.0 for Lua 5.1, Lua 5.2, and LuaJIT. (github.com)

I have seen it, I just don’t know how to implement it into the project. I don’t have any experience with bindings.

If I understand correctly that you want to call some of the SDL API from inside Lua scripts:

Try clicking the link that Slouken provided, then go to the “tutorials” folder. From there you can see examples of how to initialize SDL from Lua, open a new window, handle events, use SDL_TTF and SDL_Mixer libraries, etc.
The final tutorial is a program with a bouncing logo that can be used as a template to build a game from inside Lua.

After you’ve checked out all those tutorials, there are some additional samples back in the project’s main page “examples” folder. (Such as detecting keyboard and joystick buttons).