You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There seems to be no documentation on this specific metamethod.
My assumption based on the context is that this metamethod acts the same way as sol:call_constructor when creating a new usertype, which is to allow the syntax local val = new ClassType(), but it does not seem to work that way.
The sol2 docs say that this metamethod is sol2 specific, but doesn't elaborate any more on it. What is the intended functionality of this metamethod?
The text was updated successfully, but these errors were encountered:
The purpose of this is to enable the syntax local v = my_class( 24 ) and have that call a constructor; it has no other purpose
This is compatible with luabind, kaguya and other Lua library syntaxes and looks similar to C++ syntax, but the general consensus in Programming with Lua and other places is to use a function named new
Note that with the sol::call_constructor key, a construct type above must be specified. A free function without it will pass in the metatable describing this object as the first argument without that distinction, which can cause strange runtime errors.
There seems to be no documentation on this specific metamethod.
My assumption based on the context is that this metamethod acts the same way as
sol:call_constructor
when creating a new usertype, which is to allow the syntaxlocal val = new ClassType()
, but it does not seem to work that way.The sol2 docs say that this metamethod is sol2 specific, but doesn't elaborate any more on it. What is the intended functionality of this metamethod?
The text was updated successfully, but these errors were encountered: