|
| 1 | +<?xml version="1.0" encoding="UTF-8" ?> |
| 2 | +<class name="LuaObjectMetatable" inherits="RefCounted" version="4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd"> |
| 3 | + <brief_description> |
| 4 | + Represents a Lua Object Metatable. |
| 5 | + </brief_description> |
| 6 | + <description> |
| 7 | + This interface class allows for the definition of lua metamethods to be used for an objects metatable. Objects can define a [code]lua_metatable[/code] property that returns a LuaObjectMetatable. This metatable will be used for the object when it is passed to Lua. If one does not exists the luaAPI.object_metatable will be used instead. |
| 8 | + <tutorials> |
| 9 | + </tutorials> |
| 10 | + <methods> |
| 11 | + <method name="__add" qualifiers="virtual"> |
| 12 | + <return type="Variant" /> |
| 13 | + <param index="0" name="obj" type="Object" /> |
| 14 | + <param index="1" name="lua" type="LuaAPI" /> |
| 15 | + <param index="2" name="other" type="Variant" /> |
| 16 | + <description> |
| 17 | + The addition (+) operation. If any operand for an addition is not a number, Lua will try to call a metamethod. It starts by checking the first operand (even if it is a number); if that operand does not define a metamethod for __add, then Lua will check the second operand. If Lua can find a metamethod, it calls the metamethod with the two operands as arguments, and the result of the call (adjusted to one value) is the result of the operation. Otherwise, if no metamethod is found, Lua raises an error. |
| 18 | + </description> |
| 19 | + </method> |
| 20 | + <method name="__band" qualifiers="virtual"> |
| 21 | + <return type="Variant" /> |
| 22 | + <param index="0" name="obj" type="Object" /> |
| 23 | + <param index="1" name="lua" type="LuaAPI" /> |
| 24 | + <param index="2" name="other" type="Variant" /> |
| 25 | + <description> |
| 26 | + The bitwise AND (&) operation. Behavior similar to the addition operation, except that Lua will try a metamethod if any operand is neither an integer nor a float coercible to an integer |
| 27 | + </description> |
| 28 | + </method> |
| 29 | + <method name="__bnot" qualifiers="virtual"> |
| 30 | + <return type="Variant" /> |
| 31 | + <param index="0" name="obj" type="Object" /> |
| 32 | + <param index="1" name="lua" type="LuaAPI" /> |
| 33 | + <description> |
| 34 | + The bitwise NOT (unary ~) operation. Behavior similar to the bitwise AND operation. |
| 35 | + </description> |
| 36 | + </method> |
| 37 | + <method name="__bor" qualifiers="virtual"> |
| 38 | + <return type="Variant" /> |
| 39 | + <param index="0" name="obj" type="Object" /> |
| 40 | + <param index="1" name="lua" type="LuaAPI" /> |
| 41 | + <param index="2" name="other" type="Variant" /> |
| 42 | + <description> |
| 43 | + The bitwise OR (|) operation. Behavior similar to the bitwise AND operation. |
| 44 | + </description> |
| 45 | + </method> |
| 46 | + <method name="__bxor" qualifiers="virtual"> |
| 47 | + <return type="Variant" /> |
| 48 | + <param index="0" name="obj" type="Object" /> |
| 49 | + <param index="1" name="lua" type="LuaAPI" /> |
| 50 | + <param index="2" name="other" type="Variant" /> |
| 51 | + <description> |
| 52 | + The bitwise exclusive OR (binary ~) operation. Behavior similar to the bitwise AND operation. |
| 53 | + </description> |
| 54 | + </method> |
| 55 | + <method name="__call" qualifiers="virtual"> |
| 56 | + <return type="Variant" /> |
| 57 | + <param index="0" name="obj" type="Object" /> |
| 58 | + <param index="1" name="lua" type="LuaAPI" /> |
| 59 | + <param index="2" name="args" type="LuaTuple" /> |
| 60 | + <description> |
| 61 | + The bitwise NOT (unary ~) operation. Behavior similar to the bitwise AND operation. |
| 62 | + </description> |
| 63 | + </method> |
| 64 | + <method name="__concat" qualifiers="virtual"> |
| 65 | + <return type="Variant" /> |
| 66 | + <param index="0" name="obj" type="Object" /> |
| 67 | + <param index="1" name="lua" type="LuaAPI" /> |
| 68 | + <param index="2" name="other" type="Variant" /> |
| 69 | + <description> |
| 70 | + The concatenation (..) operation. Behavior similar to the addition operation, except that Lua will try a metamethod if any operand is neither a string nor a number (which is always coercible to a string). |
| 71 | + </description> |
| 72 | + </method> |
| 73 | + <method name="__div" qualifiers="virtual"> |
| 74 | + <return type="Variant" /> |
| 75 | + <param index="0" name="obj" type="Object" /> |
| 76 | + <param index="1" name="lua" type="LuaAPI" /> |
| 77 | + <param index="2" name="other" type="Variant" /> |
| 78 | + <description> |
| 79 | + The division (/) operation. Behavior similar to the addition operation. |
| 80 | + </description> |
| 81 | + </method> |
| 82 | + <method name="__eq" qualifiers="virtual"> |
| 83 | + <return type="bool" /> |
| 84 | + <param index="0" name="obj" type="Object" /> |
| 85 | + <param index="1" name="lua" type="LuaAPI" /> |
| 86 | + <param index="2" name="other" type="Variant" /> |
| 87 | + <description> |
| 88 | + The equal (==) operation. Behavior similar to the addition operation, except that Lua will try a metamethod only when the values being compared are either both tables or both full userdata and they are not primitively equal. The result of the call is always converted to a boolean. |
| 89 | + </description> |
| 90 | + </method> |
| 91 | + <method name="__gc" qualifiers="virtual"> |
| 92 | + <return type="LuaError" /> |
| 93 | + <param index="0" name="obj" type="Object" /> |
| 94 | + <param index="1" name="lua" type="LuaAPI" /> |
| 95 | + <description> |
| 96 | + https://www.lua.org/manual/5.4/manual.html#2.5.3 |
| 97 | + </description> |
| 98 | + </method> |
| 99 | + <method name="__idiv" qualifiers="virtual"> |
| 100 | + <return type="Variant" /> |
| 101 | + <param index="0" name="obj" type="Object" /> |
| 102 | + <param index="1" name="lua" type="LuaAPI" /> |
| 103 | + <param index="2" name="other" type="Variant" /> |
| 104 | + <description> |
| 105 | + The floor division (//) operation. Behavior similar to the addition operation. |
| 106 | + </description> |
| 107 | + </method> |
| 108 | + <method name="__index" qualifiers="virtual"> |
| 109 | + <return type="Variant" /> |
| 110 | + <param index="0" name="obj" type="Object" /> |
| 111 | + <param index="1" name="lua" type="LuaAPI" /> |
| 112 | + <param index="2" name="index" type="String" /> |
| 113 | + <description> |
| 114 | + The indexing access operation table[key]. This event happens when table is not a table or when key is not present in table. The metavalue is looked up in the metatable of table. |
| 115 | + |
| 116 | + The metavalue for this event can be either a function, a table, or any value with an __index metavalue. If it is a function, it is called with table and key as arguments, and the result of the call (adjusted to one value) is the result of the operation. Otherwise, the final result is the result of indexing this metavalue with key. This indexing is regular, not raw, and therefore can trigger another __index metavalue. |
| 117 | + </description> |
| 118 | + </method> |
| 119 | + <method name="__le" qualifiers="virtual"> |
| 120 | + <return type="bool" /> |
| 121 | + <param index="0" name="obj" type="Object" /> |
| 122 | + <param index="1" name="lua" type="LuaAPI" /> |
| 123 | + <param index="2" name="other" type="Variant" /> |
| 124 | + <description> |
| 125 | + The less equal (<=) operation. Behavior similar to the less than operation. |
| 126 | + </description> |
| 127 | + </method> |
| 128 | + <method name="__len" qualifiers="virtual"> |
| 129 | + <return type="int" /> |
| 130 | + <param index="0" name="obj" type="Object" /> |
| 131 | + <param index="1" name="lua" type="LuaAPI" /> |
| 132 | + <description> |
| 133 | + The length (#) operation. If the object is not a string, Lua will try its metamethod. If there is a metamethod, Lua calls it with the object as argument, and the result of the call (always adjusted to one value) is the result of the operation. If there is no metamethod but the object is a table, then Lua uses the table length operation. Otherwise, Lua raises an error. |
| 134 | + </description> |
| 135 | + </method> |
| 136 | + <method name="__lt" qualifiers="virtual"> |
| 137 | + <return type="bool" /> |
| 138 | + <param index="0" name="obj" type="Object" /> |
| 139 | + <param index="1" name="lua" type="LuaAPI" /> |
| 140 | + <param index="2" name="other" type="Variant" /> |
| 141 | + <description> |
| 142 | + The less than (<) operation. Behavior similar to the addition operation, except that Lua will try a metamethod only when the values being compared are neither both numbers nor both strings. Moreover, the result of the call is always converted to a boolean. |
| 143 | + </description> |
| 144 | + </method> |
| 145 | + <method name="__metatable" qualifiers="virtual"> |
| 146 | + <return type="Variant" /> |
| 147 | + <param index="0" name="obj" type="Object" /> |
| 148 | + <param index="1" name="lua" type="LuaAPI" /> |
| 149 | + <description> |
| 150 | + If object does not have a metatable, returns nil. Otherwise, if the object's metatable has a __metatable field, returns the associated value. Otherwise, returns the metatable of the given object. |
| 151 | + </description> |
| 152 | + </method> |
| 153 | + <method name="__mod" qualifiers="virtual"> |
| 154 | + <return type="Variant" /> |
| 155 | + <param index="0" name="obj" type="Object" /> |
| 156 | + <param index="1" name="lua" type="LuaAPI" /> |
| 157 | + <param index="2" name="other" type="Variant" /> |
| 158 | + <description> |
| 159 | + The modulo (%) operation. Behavior similar to the addition operation. |
| 160 | + </description> |
| 161 | + </method> |
| 162 | + <method name="__mul" qualifiers="virtual"> |
| 163 | + <return type="Variant" /> |
| 164 | + <param index="0" name="obj" type="Object" /> |
| 165 | + <param index="1" name="lua" type="LuaAPI" /> |
| 166 | + <param index="2" name="other" type="Variant" /> |
| 167 | + <description> |
| 168 | + The multiplication (*) operation. Behavior similar to the addition operation. |
| 169 | + </description> |
| 170 | + </method> |
| 171 | + <method name="__newindex" qualifiers="virtual"> |
| 172 | + <return type="LuaError" /> |
| 173 | + <param index="0" name="obj" type="Object" /> |
| 174 | + <param index="1" name="lua" type="LuaAPI" /> |
| 175 | + <param index="2" name="index" type="String" /> |
| 176 | + <param index="3" name="value" type="Variant" /> |
| 177 | + <description> |
| 178 | + The indexing assignment table[key] = value. Like the index event, this event happens when table is not a table or when key is not present in table. The metavalue is looked up in the metatable of table. |
| 179 | + |
| 180 | + Like with indexing, the metavalue for this event can be either a function, a table, or any value with an __newindex metavalue. If it is a function, it is called with table, key, and value as arguments. Otherwise, Lua repeats the indexing assignment over this metavalue with the same key and value. This assignment is regular, not raw, and therefore can trigger another __newindex metavalue. |
| 181 | + |
| 182 | + Whenever a __newindex metavalue is invoked, Lua does not perform the primitive assignment. If needed, the metamethod itself can call rawset to do the assignment. |
| 183 | + </description> |
| 184 | + </method> |
| 185 | + <method name="__pow" qualifiers="virtual"> |
| 186 | + <return type="Variant" /> |
| 187 | + <param index="0" name="obj" type="Object" /> |
| 188 | + <param index="1" name="lua" type="LuaAPI" /> |
| 189 | + <param index="2" name="other" type="Variant" /> |
| 190 | + <description> |
| 191 | + The exponentiation (^) operation. Behavior similar to the addition operation. |
| 192 | + </description> |
| 193 | + </method> |
| 194 | + <method name="__shl" qualifiers="virtual"> |
| 195 | + <return type="Variant" /> |
| 196 | + <param index="0" name="obj" type="Object" /> |
| 197 | + <param index="1" name="lua" type="LuaAPI" /> |
| 198 | + <param index="2" name="other" type="Variant" /> |
| 199 | + <description> |
| 200 | + The bitwise left shift (<<) operation. Behavior similar to the bitwise AND operation. |
| 201 | + </description> |
| 202 | + </method> |
| 203 | + <method name="__shr" qualifiers="virtual"> |
| 204 | + <return type="Variant" /> |
| 205 | + <param index="0" name="obj" type="Object" /> |
| 206 | + <param index="1" name="lua" type="LuaAPI" /> |
| 207 | + <param index="2" name="other" type="Variant" /> |
| 208 | + <description> |
| 209 | + The bitwise right shift (>>) operation. Behavior similar to the bitwise AND operation. |
| 210 | + </description> |
| 211 | + </method> |
| 212 | + <method name="__sub" qualifiers="virtual"> |
| 213 | + <return type="Variant" /> |
| 214 | + <param index="0" name="obj" type="Object" /> |
| 215 | + <param index="1" name="lua" type="LuaAPI" /> |
| 216 | + <param index="2" name="other" type="Variant" /> |
| 217 | + <description> |
| 218 | + The subtraction (-) operation. Behavior similar to the addition operation. |
| 219 | + </description> |
| 220 | + </method> |
| 221 | + <method name="__tostring" qualifiers="virtual"> |
| 222 | + <return type="String" /> |
| 223 | + <param index="0" name="obj" type="Object" /> |
| 224 | + <param index="1" name="lua" type="LuaAPI" /> |
| 225 | + <description> |
| 226 | + The tostring operation. Used when tostring is called on the object. |
| 227 | + </description> |
| 228 | + </method> |
| 229 | + <method name="__unm" qualifiers="virtual"> |
| 230 | + <return type="Variant" /> |
| 231 | + <param index="0" name="obj" type="Object" /> |
| 232 | + <param index="1" name="lua" type="LuaAPI" /> |
| 233 | + <description> |
| 234 | + The negation (unary -) operation. Behavior similar to the addition operation. |
| 235 | + </description> |
| 236 | + </method> |
| 237 | + </methods> |
| 238 | + |
| 239 | + </methods> |
| 240 | + <members> |
| 241 | + </members> |
| 242 | + <constants> |
| 243 | + </constants> |
| 244 | +</class> |
0 commit comments