- Can someone help clarify this part of the Lua Reference API, specifically in regards to the userdata data type?
“There are two kinds of userdata: full userdata, which is an object
with a block of memory managed by Lua, and light userdata, which is simply
a C pointer value. Userdata has no predefined operations in Lua, except
assignment and identity test. By using metatables, the programmer can define
operations for full userdata values (see §2.4). Userdata values cannot be
created or modified in Lua, only through the C API. This guarantees the
integrity of data owned by the host program and C libraries.”
I interpret it as follows:
- The userdata data type is an object
- An object is a complex construct of tables and metatables
- Programmers can make their own operations for full userdata objects
but they must be done via the C API; it can’t be done using Lua scripts. - Since Parts are userdata, their functionality is provided by Roblox
as a fundamental core piece of Roblox. It is possible to customize or extend their
inherent functionality but only by custom C programming and the C API.