Learn R Programming

luajr (version 0.1.8)

lua_reset: Reset the default Lua state

Description

Clears out all variables from the default Lua state, freeing up the associated memory.

Usage

lua_reset()

Arguments

Value

None.

Details

This resets the default Lua state only. To reset a non-default Lua state L returned by lua_open(), just do L <- lua_open() again. The memory previously used will be cleaned up at the next garbage collection.

Examples

Run this code
lua("a = 2")
lua_reset()
lua("print(a)") # nil

Run the code above in your browser using DataLab