aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ClientHamr/GuiLua
diff options
context:
space:
mode:
authorDavid Walter Seikel2014-03-31 20:02:38 +1000
committerDavid Walter Seikel2014-03-31 20:02:38 +1000
commit57675f3c9a8488e5cd31a95753219f03cec476e9 (patch)
tree2fae4dc63b2a3ef29a99fa3d850e2ca53df7067e /ClientHamr/GuiLua
parentNotes about Stufflets and SquealStuff. (diff)
downloadSledjHamr-57675f3c9a8488e5cd31a95753219f03cec476e9.zip
SledjHamr-57675f3c9a8488e5cd31a95753219f03cec476e9.tar.gz
SledjHamr-57675f3c9a8488e5cd31a95753219f03cec476e9.tar.bz2
SledjHamr-57675f3c9a8488e5cd31a95753219f03cec476e9.tar.xz
More Stuff notes.
Diffstat (limited to 'ClientHamr/GuiLua')
-rw-r--r--ClientHamr/GuiLua/skang.lua41
1 files changed, 24 insertions, 17 deletions
diff --git a/ClientHamr/GuiLua/skang.lua b/ClientHamr/GuiLua/skang.lua
index 46869a1..f203a83 100644
--- a/ClientHamr/GuiLua/skang.lua
+++ b/ClientHamr/GuiLua/skang.lua
@@ -369,17 +369,20 @@ Other Thing things are -
369 369
370 stuff.s = {a='foo'} -> changes a, deletes everything else, or should. 370 stuff.s = {a='foo'} -> changes a, deletes everything else, or should.
371 371
372 stuff.s[key]={...} -> stuff is a Thing, stuff.s is a Thing, stuff.s[key] NOT a Thing, unless set up before hand, which it is not since [key] is arbitrary. 372 stuff.S[key]={...} -> stuff is a Thing, stuff.S is a Thing, stuff.S[key] NOT a Thing.
373 When we do, we would be re using the same Thing for each [key]. 373 Unless set up before hand, which it is not since [key] is arbitrary.
374 Except currently Things have a module. 374 We should be re using the same Thing for each [key], but change the Thing.module.
375 rawset(stuff.s, key, skang.copy(stuff.s[''], key)) -- when creating stuff.s[key] 375 So we copy the Thing from stuff.S when putting stuff into a new [key].
376 So we could do - stuff.s.__stufflets = newThingForStufflets; stuff.s is a Thing, so it goes through __newindex, and these things will get caught. 376 So the difference is if it's a 'Stuff' or a 'table'.
377 skang.thing{'', module=stuff.s, types='Stuff'} -- Actually, the name is unimportant, this is for stuff with arbitrary names that don't match other Stuff. 377 skang.thing{'S', module=stuff, types='Stuff'}
378 stuff.s.__stufflets = newThingForStuff 378 skang.thing{'field0', module=stuff.S, ...}
379 stuff.s[''] = {} 379 skang.thing{'field1', module=stuff.S, ...}
380 skang.thing{'field0', module=stuff.s[''], ...} 380 stuff.S is a Thing, it goes through __index and __newindex, so these Things will get caught.
381 skang.thing{'field1', module=stuff.s[''], ...} 381 stuff.S[key] = {...} -> __newindex(stuff.S, key, {...})
382 So the diff is the existance of stuff.s.__stufflets, if it exists, then stuff.s[key] is checked against it, otherwise it is a non stufflet. 382 if 'Stuff' == modThing.type then
383 if nil == modThing.__values[key] then rawset(modThing.__values, key, copy(module, key))
384 stuff.S[key] = {...} -- Only do this through pairs(), and only put stuff in if it has a matching stuff.S.__stuff
385 -- Which we do already anyway, so the only change is to copy the Thing?
383 386
384 What we really want is - 387 What we really want is -
385 squeal.database('db', 'host', 'someDb', 'user', 'password') -> Should return a module. 388 squeal.database('db', 'host', 'someDb', 'user', 'password') -> Should return a module.
@@ -390,24 +393,28 @@ Other Thing things are -
390 stuff:read('someIndex') -> Grabs a single row that has the key 'someIndex', or perhaps multiple rows since this might have SQL under it. 393 stuff:read('someIndex') -> Grabs a single row that has the key 'someIndex', or perhaps multiple rows since this might have SQL under it.
391 stuff = db:read('stuff', 'select * from someTable where key='someIndex') 394 stuff = db:read('stuff', 'select * from someTable where key='someIndex')
392 395
393 stuff:stuff('') -> getmetatable(stuff).__stuff[''] 396-- stuff:stuff('') -> getmetatable(stuff).__stuff['']
394 stuff:stuff() -> getmetatable(stuff).__stuff[''] 397-- stuff:stuff() -> getmetatable(stuff).__stuff['']
395 398
396 stuff:stufflet('field1') -> stuff:stuff().__stuff['field1'] 399-- stuff:stuff('field1') -> stuff:stuff().__stuff['field1']
397 400
398 stuff:write() -> Write all rows to the database table. 401 stuff:write() -> Write all rows to the database table.
399 stuff:write(1) -> Write one row to the database table. 402 stuff:write(1) -> Write one row to the database table.
400 stuff:stufflet('field1').isValid = someFunction 403 stuff:stuff('field1').isValid = someFunction -- Should work, all stuff[key] shares the same stuff.
401 stuff:isValid(db) -> Validate the entire stuff against it's metadata at least. 404 stuff:isValid(db) -> Validate the entire stuff against it's metadata at least.
402 window.stuff = stuff -> Window gets stuff as it's default stuff, any widgets with same names as the table fields get linked. 405 window.stuff = stuff -> Window gets stuff as it's default stuff, any widgets with same names as the table fields get linked.
403 grid.stuff = stuff -> Replace contents of this grid widget with data from all the rows in stuff. 406 grid.stuff = stuff -> Replace contents of this grid widget with data from all the rows in stuff.
404 choice.stuff = stuff -> As in grid, but only using the keys. 407 choice.stuff = stuff -> As in grid, but only using the keys.
405 widget.stuff = stuff:stufflet('field1') -> This widget gets a particular stufflet. 408 widget.stuff = stuff:stuff('field1') -> This widget gets a particular stufflet.
409 widget would have to look up getmetatable(window.stuff).module. Or maybe this should work some other way?
406 410
407 In all these cases above, stuff is a table that has a Thing metatable, so it has __stuff. 411 In all these cases above, stuff is a table that has a Thing metatable, so it has __stuff.
408 It also has a .__stufflets. 412 It is also a Stuff.
409 Should include some way of specifyings details like key name, where string, etc. 413 Should include some way of specifyings details like key name, where string, etc.
414 getmetatable(stuff).__keyName
415 getmetatable(stuff).__where
410 And a way to link this database table to others, via the key of the other, as a field in this Stuff. 416 And a way to link this database table to others, via the key of the other, as a field in this Stuff.
417 stuff:stuff('field0').__link = {module, key, index}
411 In Java we had this - 418 In Java we had this -
412 419
413public class PersonStuff extends SquealStuff 420public class PersonStuff extends SquealStuff