making setting immutables an error

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9626 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Mark Gossage 2006-12-21 04:53:12 +00:00
commit bc08e0f335
6 changed files with 90 additions and 39 deletions

View file

@ -55,15 +55,20 @@ example.print_vars()
print "\nNow I'm going to try and modify some read only variables";
print " Tring to set 'path' to 'Whoa!'";
example.path = "Whoa!"
print " This request was silently ignored by Lua. "
print " But the data has not been changed"
print("path =", example.path)
if pcall(function() example.path = "Whoa!" end)==true then
print " Thats funny, it didn't give an error!"
else
print " It gave an error, as it should"
end
print(" Just checking the value: path =", example.path)
print " Trying to set 'status' to '0'";
example.status = 0
print " Again silently ignored"
print("status =", example.status)
if pcall(function() example.status = 0 end)==true then
print " Thats funny, it didn't give an error!"
else
print " It gave an error, as it should"
end
print(" Just checking the value: status =", example.status)
print "\nI'm going to try and update a structure variable.\n"