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
When attempting to modify a parameter by itself works perfectly, however when that parameter is a table, attempting to change the value in that table the value becomes null. I have some examples below:
All are called using this C# code:
object args = new { barcode = "1234567890" };
var resultstr = lua.LuaCall("immutabletest4", args);
Test 1: Here the resultstr is null (Error case!)
function immutabletest(args)
args.barcode = '1234'
return args.barcode
end
Test 2: Here resultstr gets the value "1234567890", as it should
function immutabletest2(args)
barcode = args.barcode or nil
return barcode
end
Test 3: Here resultstr gets the value "1234567890", as it should
function immutabletest3(args)
return args.barcode
end
Test 4: Here resultstr gets the value "1234", as it should. I was testing immutability of parameters, and they aren't.
function immutabletest4(barcode)
barcode = '1234'
return barcode
end
The text was updated successfully, but these errors were encountered:
So, it appears this may be a slight confusion. It appears that if the original .NET object is immutable, then the parameter is immutable. If I create a class with a property "barcode", the Example #1 works correctly. I still think this may be a bug, as it's immutability is only known outside the context of the script.
When attempting to modify a parameter by itself works perfectly, however when that parameter is a table, attempting to change the value in that table the value becomes null. I have some examples below:
All are called using this C# code:
Test 1: Here the resultstr is null (Error case!)
Test 2: Here resultstr gets the value "1234567890", as it should
Test 3: Here resultstr gets the value "1234567890", as it should
Test 4: Here resultstr gets the value "1234", as it should. I was testing immutability of parameters, and they aren't.
The text was updated successfully, but these errors were encountered: