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
- Host: GitHub
- URL: https://github.com/royratcliffe/lua51
- Owner: royratcliffe
- License: other
- Created: 2022-02-12T20:02:22.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-02-13T12:59:33.000Z (over 4 years ago)
- Last Synced: 2023-04-11T20:50:39.804Z (about 3 years ago)
- Topics: lua, r, r-package
- Language: R
- Homepage: https://royratcliffe.github.io/lua51/
- Size: 32.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
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
[](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[](https://CRAN.R-project.org/package=lua51)
[](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.