Skip to content
This repository was archived by the owner on Dec 8, 2023. It is now read-only.
/ clipper-luajit-ffi Public archive

LuaJIT FFI bindings for Angus Johnson's Clipper library

License

Notifications You must be signed in to change notification settings

apicici/clipper-luajit-ffi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Give Up GitHub

This project has given up GitHub. (See Software Freedom Conservancy's Give Up GitHub site for details.)

You can now find this project at https://codeberg.org/apicici/clipper-luajit-ffi instead.

Any use of this project's code by GitHub Copilot, past or present, is done without our permission. We do not consent to GitHub's use of this project's code in Copilot.

Join us; you can give up GitHub too!

Logo of the GiveUpGitHub campaign

clipper-luajit-ffi

LuaJIT FFI bindings for the C++ version of Angus Johnson's Clipper library.

Pre-built binaries

Pre-built binaries can be found in the releases page for the following systems/architectures:

  • Linux x64
  • Windows x86, x64
  • macos x64

Compilation

The shared library required for LuaJIT FFI can be compiled using CMake with the provided CMakeLists.txt.

Usage

C++ library

Refer to the Clipper library's documentation for usage of the C++ library.

LuaJIT bindings

  1. Place the shared library (clipper.so, clipper.dll, or clipper.dylib, depending on the system) and clipper.lua somewhere where they can be found by require. You may need to modify package.path and package.cpath.
  2. Require the library with
    local clipper = require "clipper"

Notes

  • Lua numbers are automatically converted to Clipper's CInt type. However, CInt cdata objects are not automatically converted to numbers (use tonumber to convert them).
  • FFI does not use explicit pointers or references. Just pass an object to a function, and it will be treated as a value, pointer, or reference as necessary
  • Clipper Path and Paths are wrapped in Lua and (mostly) behave as std::vector. Usage examples:
    path = clipper.Path() -- initialise empty vector
    path.push_back(clipper.IntPoint(1,2)) -- add IntPoint to vector
    
    path = clipper.Path(3) -- initialise vector of size 3
    path[0] = clipper.IntPoint(2, 3) -- specify first IntPoint in vector

About

LuaJIT FFI bindings for Angus Johnson's Clipper library

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages