Skip to content

MurdochITSociety/LuaAndLuaBridgeTemplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lua And LuaBridge Template

A simple C++ Lua and Luabridge Example Template to play with.

If you have any feedback for our repositories or want to join please head over to our Discord

Example of how to use Lua and LuaBridge

Requirements

  • CMake
  • A C++ 17+ Compiler (Only if you chose to not update the CMake)

Download and Setup

Ensure you have a git client installed, we will be using git from the command line in this example.

Navigate to the directory you will want to clone into.

git clone https://github.com/MurdochITSociety/LuaAndLuaBridgeTemplate.git
cd LuaAndLuaBridgeTemplate

This example uses submodules for its external liberies and compiles them from source. Since we are using submodules we will need to retrieve them with the following command.

git submodule update --init --recursive --depth 1
  • init: initialises the submodule.
  • recursive: This is required because the lua submodule also contains another submodule that is required.
  • depth(X): Shallow clones with a depth of X.

A Simple trick

For the simpliest way of being able to modify lua scripts with out having to copy them around when you build it is advised that you edit the root CMakeLists.txt and modify the following...

option(CopyResources "CopyResources" ON)

to...

option(CopyResources "CopyResources" OFF)

This will instead create a symlink instead of a copying them every build. However on Windows you will either need to turn developer mode on or run your IDE / command prompt with administrator privilages.

Building using CMake

Visual Studio 2019

To open this in VS2019 do the following...

  1. Open Visual Studio 2019.
  2. If a dialog prompts to open a file/project click "Continue with out project" in the bottom right.
  3. Click File on the toolbar in the top left.
  4. Click Open.
  5. Click Open CMake
  6. Navigate to LuaAndLuaBridgeTemplate and open CMakeLists.txt
  7. Wait for the CMake to generate. You should now be ready to compile and run with out having to worry about linking :D.

Build from CMAKE CLI

Open a terminal or command prompt and navigate to LuaAndLuaBridgeTemplate.

  1. Type "cmake -S . -B build"
  2. Now change into the directory by typing "cd build"
  3. Build it by typing "make"
  • If on UNIX type "./LuaBridgeExample"
  • If on windows type "./LuaBridgeExample.exe"

About

A simple C++ Lua and Luabridge project for experimenting with.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •