An open API service indexing awesome lists of open source software.

https://github.com/royratcliffe/lua51

Wraps Lua 5.1.5 state machine using Rcpp
https://github.com/royratcliffe/lua51

lua r r-package

Last synced: 16 days ago
JSON representation

Wraps Lua 5.1.5 state machine using Rcpp

Awesome Lists containing this project

README

          

---
output: github_document
---

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```

# lua51

[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![CRAN status](https://www.r-pkg.org/badges/version/lua51)](https://CRAN.R-project.org/package=lua51)
[![R build status](https://github.com/royratcliffe/lua51/workflows/R-CMD-check/badge.svg)](https://github.com/royratcliffe/lua51/actions?workflow=R-CMD-check)

The goal of lua51 is to ...

## Installation

You can install the development version of lua51 like so:

``` r
# FILL THIS IN! HOW CAN PEOPLE INSTALL YOUR DEV PACKAGE?
```

## Example

This is a basic example which shows you how to solve a common problem:

```{r example}
library(lua51)
## basic example code
```

## Rcpp packaging

[rcpp.org]:http://www.rcpp.org/

See [Rcpp][rcpp.org] for full details. This section simply sets out some abbreviated notes. The package applies `use_rcpp` from `usethis` in order to set up a C++ package.
```r
usethis::create_tidy_package("lua51")
usethis::use_package_doc()
usethis::use_rcpp()
```
The package comprises a single `Rcpp` module.
```cpp
RCPP_MODULE(lua51) {
using namespace Rcpp;
}
```

But why C++ integration when Lua is pure C? The decision is one of style. All of the low-level Lua interface functions interact with a Lua 'State' encapsulating a single mutable Lua state machine. The design wraps this State into an object that you can instantiate using S6 class mechanisms. The S6 layer acts as a thin shim between R's object world and the underlying Lua implementation.