Code: Select all

```
function player:initialize()
variables ...
...
...
end
```

I was wondering if someone could point me out how to do proper getters/setters so that fx. if I want to get the variable hp, which is a table with more values,

I would get the first value in the table ie: hp[0] from player.

example

Code: Select all

```
hp = {[1] = 2, [2] = 4, [3] = 6}
```

Code: Select all

```
player:get(variable)
if type(self[variable]) == "table" then
return self[variable][1]
else
return self[variable]
end
```

I've played around with the tables, but couldn't get it to work