Struct rlua::LuaUserDataMethods [] [src]

pub struct LuaUserDataMethods<T> { /* fields omitted */ }

Stores methods of a userdata object.

Methods added will be added to the __index table on the metatable for the userdata, so they can be called as userdata:method(args) as expected. If there are any regular methods, and an Index metamethod is given, it will be called as a fallback if the index doesn't match an existing regular method.

Methods

impl<T: LuaUserDataType> LuaUserDataMethods<T>
[src]

Add a regular method as a function which accepts a &T as the first parameter.

Add a regular method as a function which accepts a &mut T as the first parameter.

Add a regular method as a function which accepts generic arguments, the first argument will always be a LuaUserData of type T.

Add a metamethod as a function which accepts a &T as the first parameter. This can cause an error with certain binary metamethods that can trigger if ony the right side has a metatable.

Add a metamethod as a function which accepts a &mut T as the first parameter. This can cause an error with certain binary metamethods that can trigger if ony the right side has a metatable.

Add a metamethod as a function which accepts generic arguments. Metamethods in Lua for binary operators can be triggered if either the left or right argument to the binary operator has a metatable, so the first argument here is not necessarily a userdata of type T.