aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ClientHamr/GuiLua/skang.lua
diff options
context:
space:
mode:
Diffstat (limited to 'ClientHamr/GuiLua/skang.lua')
-rw-r--r--ClientHamr/GuiLua/skang.lua47
1 files changed, 18 insertions, 29 deletions
diff --git a/ClientHamr/GuiLua/skang.lua b/ClientHamr/GuiLua/skang.lua
index 9e3dfd8..25886c2 100644
--- a/ClientHamr/GuiLua/skang.lua
+++ b/ClientHamr/GuiLua/skang.lua
@@ -206,6 +206,13 @@ csv2table = function (csv)
206end 206end
207 207
208 208
209shiftLeft = function (tab)
210 local result = tab[1]
211 table.remove(tab, 1)
212 return result
213end
214
215
209-- My clever boolean check, this is the third language I've written this in. B-) 216-- My clever boolean check, this is the third language I've written this in. B-)
210-- true 1 yes ack ok one positive absolutely affirmative 'ah ha' 'shit yeah' 'why not' 217-- true 1 yes ack ok one positive absolutely affirmative 'ah ha' 'shit yeah' 'why not'
211local isTrue = 't1aopswy' 218local isTrue = 't1aopswy'
@@ -624,35 +631,22 @@ thingasm = function (names, ...)
624 631
625 -- Check how we were called, and re arrange stuff to match. 632 -- Check how we were called, and re arrange stuff to match.
626 if 0 == #params then 633 if 0 == #params then
627 if ('table' == type(names)) then 634 if ('table' == type(names)) then -- thingasm{...}
628 -- thingasm{...}
629 params = names 635 params = names
630 names = params[1] 636 names = shiftLeft(params)
631 table.remove(params, 1) 637 if 'table' == type(names) then -- thingasm{module, 'foo', ...}
632 if 'table' == type(names) then
633 -- thingasm{module, 'foo', ...}
634 module = names 638 module = names
635 names = params[1] 639 names = shiftLeft(params)
636 table.remove(params, 1)
637 end 640 end
638 else 641 end -- thingasm("foo") otherwise
639 -- thingasm("foo")
640 end
641 else 642 else
642 if 'table' == type(names) then 643 if 'table' == type(names) then
643 module = names 644 module = names
644 if 'string' == type(...) then 645 if 'string' == type(...) then params = {...} -- C or __call(table, string, ..)
645 -- C or __call(table, string, ..) 646 elseif 'table' == type(...) then params = ... -- __call(table, table)
646 params = {...}
647 elseif 'table' == type(...) then
648 -- __call(table, table)
649 params = ...
650 end 647 end
651 names = params[1] 648 names = shiftLeft(params)
652 table.remove(params, 1) 649 end -- thingasm('foo', ...) otherwise
653 else
654 -- thingasm('foo', ...)
655 end
656 end 650 end
657 651
658 -- Break out the names. 652 -- Break out the names.
@@ -683,23 +677,18 @@ thingasm = function (names, ...)
683 end 677 end
684 678
685 local thingy = modThing.__stuff[name] 679 local thingy = modThing.__stuff[name]
686 if not thingy then -- This is a new Thing. 680 if not thingy then -- This is a new Thing.
687 new = true 681 new = true
688 thingy = {} 682 thingy = {}
689 thingy.module = module 683 thingy.module = module
690 thingy.names = names 684 thingy.names = names
691 -- To pick up isValid, pattern, and the other stuff. 685 setmetatable(thingy, {__index = Thing}) -- To pick up isValid, pattern, and the other stuff.
692 setmetatable(thingy, {__index = Thing})
693 end 686 end
694 687
695 -- Pull out positional arguments. 688 -- Pull out positional arguments.
696 thingy.help = params[1] or thingy.help 689 thingy.help = params[1] or thingy.help
697 thingy.default = params[2] or thingy.default 690 thingy.default = params[2] or thingy.default
698 local types = params[3] or table.concat(thingy.types or {}, ',') 691 local types = params[3] or table.concat(thingy.types or {}, ',')
699 thingy.widget = params[4] or thingy.widget
700 thingy.required = params[5] or thingy.required
701 thingy.acl = params[6] or thingy.acl
702 thingy.boss = params[7] or thingy.boss
703 692
704 -- Pull out named arguments. 693 -- Pull out named arguments.
705 for k, v in pairs(params) do 694 for k, v in pairs(params) do