---
name: "CL_LuaReference"
section: "3"
platform: "linux"
package: "clanlib0-common-dev"
version: "0.4.4-8"
release: "Debian 3.0 (Woody)"
platforms: ["linux"]
url: "https://new.carta.tech/CL_LuaReference"
---

# CL\_LuaReference(3)

Lua reference

## NAME

CL\_LuaReference - Lua reference

## DESCRIPTION

If the user needs to store references to LuaObject, this reference must be explicitly created, creating objects of this class.

Inherited from public CL\_LuaObject

## CLASS MEMBERS

- **CL\_LuaReference**(

  ```
  void)
  ```

- **CL\_LuaReference**(

  ```
  const CL_LuaObject& obj,
  int lock=0)
  ```

- void **ref**(

  ```
  const CL_LuaObject& obj,
  int lock=0)
  ```

- void **unref**(

  ```
  void)
  ```

## MEMBERS WITH DESCRIPTIONS

- **CL\_LuaReference**(

  ```
  void)
  ```

  ```
  Description:
  ```

  Create a reference to a *nil* object (default)

- **CL\_LuaReference**(

  ```
  const CL_LuaObject& obj,
  int lock=0)
  ```

  ```
  Parameters:
  lock - to lock or not to lock, that is the question
  ```

  ```
  Description:
  ```

  Create a reference to the given Lua object An optinal parameter specifies if the reference is not to be garbage collected by Lua. The default, {lock=0}, means the reference becomes invalid if Lua collects the referenced object.

- void **ref**(

  ```
  const CL_LuaObject& obj,
  int lock=0)
  ```

  ```
  Description:
  ```

  Replace the reference This method allows the user to replace the referenced object; it is useful when the object is created with the default constructor. \_Note\_: if there is already a reference to a non-'nil' object, this reference, if not used by other LuaReference objets, should be eliminated (using the 'unref' method) before calling this method.

- void **unref**(

  ```
  void)
  ```

  ```
  Description:
  ```

  Unreference an object

## SEE ALSO

All ClanLib API classes can be found in **clanlib (3)**.

## AUTHORS

Originally written by Magnus Norddahl \<*mbn@dark.x.dtu.dk*\> and Martin Starch \<*starch@dark.x.dtu.dk*\>. ClanLib is now developed by the ClanLib Development team as an Open Source project.

The ClanLib man pages was created using the Perceps documentation system (another excellent piece of Open Source software, available at **http://somewhere.in.the.world.org**).

See **clanlib (3)** to find out how to get a full list of contributors and details on how to submit bug reports, comments etc.
