Lua Programming/userdata

From Wikibooks, open books for an open world
Jump to navigation Jump to 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 | edit source]

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

Predefined operations[edit | edit source]

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 | edit source]

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

Light userdata[edit | edit source]

Heavy userdata[edit | edit source]