luajr-package: luajr: LuaJIT Scripting

luajr-packageR Documentation

luajr: LuaJIT Scripting

Description

An interface to 'LuaJIT' https://luajit.org, a just-in-time compiler for the 'Lua' scripting language https://www.lua.org. Allows users to run 'Lua' code from 'R'.

The R API

You can use these functions to run Lua code from R:

  • lua(): run Lua code from a string or file

  • lua_func(): make a Lua function callable from R

  • lua_shell(): run an interactive Lua shell

  • lua_module(), lua_import(): load Lua modules

  • lua_open(): create a new Lua state

  • lua_reset(): reset the default Lua state

  • lua_mode(), lua_profile(): debugger, profiler, and JIT options

The Lua API

In your Lua code, you can use the luajr module and the R module to interact with R functions, values, and types.

The luajr module offers higher-level access to R functions and types, similar to the convenience API offered by Rcpp or cpp11 for use in C++. See vignette("luajr-module") for more details.

The R module offers lower-level access to R functions and types, similar to R's built-in C API. See vignette("R-module") for more details.

Further reading

For an introduction to luajr, see vignette("luajr").

For a guide to writing Lua modules for use from your R package or project, see vignette("modules").

Author(s)

Maintainer: Nicholas Davies nicholas.davies@lshtm.ac.uk (ORCID) (Author of the R package wrapper) [contributor, copyright holder]

Authors:

  • Mike Pall (Author of the embedded LuaJIT compiler) [copyright holder]

Other contributors:

  • Lua.org, PUC-Rio (Copyright holders over portions of Lua source code included in LuaJIT) [copyright holder]

  • Scott Lembcke, Howling Moon Software (Authors of the embedded debugger.lua debugger) [contributor, copyright holder]

See Also

Useful links:


luajr documentation built on June 3, 2026, 1:06 a.m.