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
C# supports an object initializer syntax on construction like so:
var myObj = new MyClass() {someOptionalProperty="value"};
Likewise Lua standard 16.1 supports this on its native values via OO syntactic sugar:
myLuaObj = MyLuaPrototype:new{someOptionalProperty="value"};
However, MoonSharp does not support this syntactic sugar when creating CLR objects:
myClrObj = MyClass:__new{someOptionalProperty="value"}; --Expected: myClrObj.someOptionalProperty == "value", actual: myClrObj.someOptionalProperty == nil
It would be nice if creation of CLR objects from Lua respected the same initialization/table constructor syntax available to Lua objects. Bonus if the "__new" CLR constructor method name could be changed/aliased to "new" to be consistent with the rest of the Lua world as well.
The text was updated successfully, but these errors were encountered:
C# supports an object initializer syntax on construction like so:
var myObj = new MyClass() {someOptionalProperty="value"};
Likewise Lua standard 16.1 supports this on its native values via OO syntactic sugar:
myLuaObj = MyLuaPrototype:new{someOptionalProperty="value"};
However, MoonSharp does not support this syntactic sugar when creating CLR objects:
myClrObj = MyClass:__new{someOptionalProperty="value"}; --Expected: myClrObj.someOptionalProperty == "value", actual: myClrObj.someOptionalProperty == nil
It would be nice if creation of CLR objects from Lua respected the same initialization/table constructor syntax available to Lua objects. Bonus if the "__new" CLR constructor method name could be changed/aliased to "new" to be consistent with the rest of the Lua world as well.
The text was updated successfully, but these errors were encountered: