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
Constructors added in this fashion are called from Lua using the fully qualified name of the class. This Lua code will create instances of `A` and `B`.
735
+
Constructors added in this fashion are called from Lua using the `.new` field on the class. This Lua code will create instances of `A` and `B`.
736
736
737
737
```lua
738
-
a = test.A () -- Create a new A.
739
-
b = test.B ("hello", 5) -- Create a new B.
740
-
b = test.B () -- Error: expected string in argument 1
738
+
a = test.A.new () -- Create a new A.
739
+
b = test.B.new ("hello", 5) -- Create a new B.
740
+
b = test.B.new () -- Error: expected string in argument 1
hard = test.HardToCreate (5) -- Create a new HardToCreate.
767
+
hard = test.HardToCreate.new (5) -- Create a new HardToCreate.
768
768
```
769
769
770
-
The `addConstructor` overload taking a generic functor also accepts a `lua_State*` as last parameter in order to be used for constructors that needs to be overloaded by different numbers of arguments (arguments will start at index 2 of the stack):
770
+
The `addConstructor` overload taking a generic functor also accepts a `lua_State*` as last parameter in order to be used for constructors that needs to be overloaded by different numbers of arguments (arguments will start at index 1 of the stack):
0 commit comments