|
Revision 8587
(checked in by robert, 6 months ago)
|
Added Data for osgWidget examples
|
| Line | |
|---|
| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
Table = {} |
|---|
| 5 |
|
|---|
| 6 |
function Table:new () |
|---|
| 7 |
local t = {} |
|---|
| 8 |
|
|---|
| 9 |
setmetatable(t, self) |
|---|
| 10 |
|
|---|
| 11 |
self.__index = self |
|---|
| 12 |
|
|---|
| 13 |
return t |
|---|
| 14 |
end |
|---|
| 15 |
|
|---|
| 16 |
function Table:__concat (other) |
|---|
| 17 |
return tostring(self) .. other |
|---|
| 18 |
end |
|---|
| 19 |
|
|---|
| 20 |
function Table:foo (x) |
|---|
| 21 |
print("foo: " .. self .. x.x) |
|---|
| 22 |
print(self .. x.x) |
|---|
| 23 |
end |
|---|
| 24 |
|
|---|
| 25 |
Table.__metatable = "Protected" |
|---|
| 26 |
|
|---|
| 27 |
t1 = Table:new() |
|---|
| 28 |
t2 = Table:new() |
|---|
| 29 |
|
|---|
| 30 |
t1:foo{x="hello", y="world"} |
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 |
]] |
|---|
| 34 |
|
|---|
| 35 |
print("Our exising window var is: " .. window) |
|---|
| 36 |
|
|---|
| 37 |
w = osgwidget.newWidget() |
|---|
| 38 |
|
|---|
| 39 |
print("A new Widget is: " .. w) |
|---|