[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: A question of scoping (I think)
- From: RLake@...
- Date: Tue, 13 Apr 2004 17:07:29 +0100
> myObj = {}
> myObj.xPos = 10;
> myObj.someVal = 100;
> Now, I would like it if I could write a function:
> function myObj.update()
> --some code
> someVal = xPos * 10
> --remaining code
> end
do
myObj = {}
local xPos, someVal = 10, 100;
function myObj.update()
-- some code
someVal = xPos + 10
-- some more code
end
end
This means myObj's xPos and someVal are completely
private. Some would say that was a Good Thing.