Lua Programming/How to Lua/userdata

From Wikibooks, open books for an open world
< Lua Programming‎ | How to Lua
Jump to: navigation, search

The userdata datatype can be used to store raw memory data in variables.

Userdata values can only be created or modified via the application interface[edit]

In lua, it is not possible to create or modify userdata except via the C application interface.

Predefined operations[edit]

The only predefined operations that can be performed against userdata is assignment and identity testing. It is possible to define operations for userdata by using metatables

There are two forms of userdata[edit]

The datatype userdata takes two forms: Light Userdata and Heavy Userdata.

Light userdata[edit]

Heavy userdata[edit]