Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More OO mumbo-jumbo thinking out loud
- Loading branch information
Showing
2 changed files
with
218 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
local function r_menu1() | ||
return "menu" | ||
end | ||
|
||
local function r_menu2() | ||
return "menu" | ||
end | ||
|
||
local function r(type,...) | ||
return function() return type end | ||
end | ||
|
||
local function r_menu(t) | ||
return r'menu', t | ||
end | ||
|
||
local function r_button(...) | ||
return r('button',...) | ||
end | ||
|
||
-- Unordered resource table | ||
local t = { | ||
[ r_menu1 ] = { | ||
"(Apple)", {}, | ||
"Aquamacs", {}, | ||
"File", {}, | ||
"Edit", {}, | ||
"Options", {}, | ||
"Tools", {}, | ||
"Lua", {}, | ||
"Window", {}, | ||
"Help", {}, | ||
}, | ||
[ r_menu2 ] = { | ||
"Blah", | ||
"Gah", | ||
"Dah", | ||
}, | ||
[ r'menu' ] = { | ||
"Gosho", | ||
}, | ||
[ r'menu' ] = { | ||
"Bosho", | ||
}, | ||
[ function() return "menu" end ] = { | ||
"Tosho", | ||
}, | ||
r_menu { | ||
"Kotooshu", | ||
}, | ||
} | ||
|
||
for k,v in pairs(t) do | ||
print(k,v) | ||
-- print(k, k(), v[1]) | ||
end | ||
|
||
-- No order in here | ||
local form = { | ||
[ r'button' ] = { | ||
x = 10, y = 20, | ||
}, | ||
[ r'button' ] = { | ||
x = 10, y = 20, | ||
}, | ||
[ r_button() ] = { | ||
x = 10, y = 20, | ||
}, | ||
[ r_button() ] = { | ||
x = 10, y = 20, | ||
}, | ||
[ r_button() ] = { | ||
x = 10, y = 20, | ||
}, | ||
[ r_button(10,20) ] = { | ||
x = 10, y = 20, | ||
}, | ||
[ r_button{ 10, 20 } ] = { | ||
x = 10, y = 20, | ||
}, | ||
[ r_button{ 10, 20 } ] = {}, | ||
[ r_button { | ||
x = 10, | ||
y = 20 | ||
} ] = {}, | ||
[r( 'button',{ | ||
x = 10, | ||
y = 20 | ||
})] = {}, | ||
} | ||
|
||
for k,v in pairs(form) do | ||
print(k,k(),v) | ||
end | ||
|
||
-- local r = require( "lib/ui/r" ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters