diff options
Diffstat (limited to '')
-rw-r--r-- | ClientHamr/GuiLua/skang.lua | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/ClientHamr/GuiLua/skang.lua b/ClientHamr/GuiLua/skang.lua index e6b6725..fdd61de 100644 --- a/ClientHamr/GuiLua/skang.lua +++ b/ClientHamr/GuiLua/skang.lua | |||
@@ -881,7 +881,9 @@ thingasm = function (names, ...) | |||
881 | local args, err = loadstring('return ' .. thingy.widget) | 881 | local args, err = loadstring('return ' .. thingy.widget) |
882 | if args then | 882 | if args then |
883 | setfenv(args, parent) | 883 | setfenv(args, parent) |
884 | parent.W[name] = {widget = widget(args())} | 884 | local result = widget(args()) |
885 | print('NO IDEA WHY this does isValid() three times on the action, and the first one being a string.') | ||
886 | parent.W[name] = {Cwidget = result} | ||
885 | else | 887 | else |
886 | print("ERROR - " .. err) | 888 | print("ERROR - " .. err) |
887 | end | 889 | end |
@@ -1025,21 +1027,21 @@ thingasm('nada', 'Do nothing.', function () --[[ This function intentionally lef | |||
1025 | local widgets = {} | 1027 | local widgets = {} |
1026 | --thingasm{widgets, 'window', 'The window.', types='userdata'} | 1028 | --thingasm{widgets, 'window', 'The window.', types='userdata'} |
1027 | thingasm{widgets, 'W', 'Holds all the widgets', types='Keyed'} | 1029 | thingasm{widgets, 'W', 'Holds all the widgets', types='Keyed'} |
1028 | widgets.W{'widget', 'The widget.', types='userdata'} | 1030 | widgets.W{'Cwidget', 'The widget.', types='userdata'} |
1029 | widgets.W{'action,a', 'The action for the widget.', 'nada', types='string'} | 1031 | widgets.W{'action,a', 'The action for the widget.', 'nada', types='string'} |
1030 | local aIsValid = function (self, parent) | 1032 | local aIsValid = function (self, parent) |
1031 | local result = Thing.isValid(self, parent) | 1033 | local result = Thing.isValid(self, parent) |
1032 | 1034 | ||
1033 | if result then | 1035 | if result then |
1034 | local value = parent[self.names[1] ] | 1036 | local value = parent[self.names[1] ] |
1035 | print('NEW ACTION - ' .. self.names[1] .. ' = ' .. value) | 1037 | print('NEW ACTION - ' .. self.names[1] .. ' = ' .. value .. ' ' .. type(parent.Cwidget)) |
1036 | --printTableStart(parent, '', 'parent') | 1038 | action(parent.Cwidget, value) |
1037 | action(parent.widget, value) | ||
1038 | end | 1039 | end |
1039 | return result | 1040 | return result |
1040 | end | 1041 | end |
1041 | 1042 | ||
1042 | widgets.W{'look,l', 'The look of the widget.', types='string'} | 1043 | widgets.W{'look,l', 'The look of the widget.', types='string'} |
1044 | --[[ | ||
1043 | widgets.W{'colour,color,c', 'The colours of the widget.', types='table'} | 1045 | widgets.W{'colour,color,c', 'The colours of the widget.', types='table'} |
1044 | widgets.W.c{'red,r', 'The red colour of the widget.', 255, types='number'} | 1046 | widgets.W.c{'red,r', 'The red colour of the widget.', 255, types='number'} |
1045 | widgets.W.c{'green,g', 'The green colour of the widget.', 255, types='number'} | 1047 | widgets.W.c{'green,g', 'The green colour of the widget.', 255, types='number'} |
@@ -1051,11 +1053,12 @@ local wMum = getmetatable(widgets.W.c) | |||
1051 | wMum.__call = function (func, ...) | 1053 | wMum.__call = function (func, ...) |
1052 | return Colour(func, ...) | 1054 | return Colour(func, ...) |
1053 | end | 1055 | end |
1056 | ]] | ||
1054 | 1057 | ||
1055 | window = function(w, h, title, name) | 1058 | window = function(w, h, title, name) |
1056 | name = name or 'myWindow' | 1059 | name = name or 'myWindow' |
1057 | local win = {} | 1060 | local win = {} |
1058 | win.W = copy(widgets.W, name) | 1061 | win = copy(widgets, name) |
1059 | local wMum, wThingy = getStuffed(win.W, 'a') | 1062 | local wMum, wThingy = getStuffed(win.W, 'a') |
1060 | wThingy.isValid = aIsValid | 1063 | wThingy.isValid = aIsValid |
1061 | win.window = Cwindow(w, h, title, name) | 1064 | win.window = Cwindow(w, h, title, name) |