Lua datatypes: Difference between revisions
From wikinotes
(→Table) |
(→Thread) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 52: | Line 52: | ||
<blockquote> | <blockquote> | ||
Represents a block of raw memory.<br> | Represents a block of raw memory.<br> | ||
Passed as a reference.<br> | |||
* full userdata -- an object with a block of memory managed by lua | * full userdata -- an object with a block of memory managed by lua | ||
* light userdata -- a C pointer value | * light userdata -- a C pointer value | ||
Line 58: | Line 59: | ||
== Thread == | == Thread == | ||
<blockquote> | <blockquote> | ||
Passed as a reference. | |||
</blockquote><!-- Thread --> | </blockquote><!-- Thread --> | ||
</blockquote><!-- Primitives --> | </blockquote><!-- Primitives --> | ||
Line 66: | Line 67: | ||
== Table == | == Table == | ||
<blockquote> | <blockquote> | ||
Associative arrays | Associative arrays, passed as references to an object. | ||
* keys any lua value, except nil | * keys any lua value, except nil (including functions) | ||
* values may be any lua value, except nil | * values may be any lua value, except nil | ||
</blockquote><!-- Table --> | </blockquote><!-- Table --> | ||
</blockquote><!-- Collections --> | </blockquote><!-- Collections --> |
Latest revision as of 20:46, 11 February 2024
Documentation
Primitives
Nil
nil
is the absence of a valuenil
within a table represents an absent keynil
Boolean
true falseNumber
A single type number represents both 64-bit integers/floats.
123 123.4String
An immutable byte-sequence, encoding-agnostic.
All strings must fit iwthin a single integer.Function
Lua can call native lua, and C functions.
UserData
Represents a block of raw memory.
Passed as a reference.
- full userdata -- an object with a block of memory managed by lua
- light userdata -- a C pointer value
Thread
Passed as a reference.
Collections
Table
Associative arrays, passed as references to an object.
- keys any lua value, except nil (including functions)
- values may be any lua value, except nil