aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/GuiLua/test.skang
blob: cbd848da5c85704e85c93fb2b85ececc32696b5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env skang -l test     -- Lua allows this shell hack.

-- There's an implied skang = require 'skang'
-- There's an implied test = require 'test'

-- This is a bit more verbose than I wanted.  lol
local win = skang.window(200, 100, "G'day planet.", 'testWindow')
skang.thingasm{win, 'quitter', 'Quits the skang window', types = 'widget', widget='"button", "Quit", 10, 10, 100, 30'}
win.W.quitter.action = 'skang.quit()'  -- TODO Should look it up in ThingSpace.commands, and translate 'quit' into the Lua 'skang.quit()'?

skang.thingasm{win, 'ffuncer', 'Calls ffunc', types = 'widget', widget='"button", "ffunc()", 10, 40, 100, 30', action='ffunc(3, 4)'}

test.bar = 'things'
test.ffunc(1, 'two')


--[[  Ideas to make this less verbose.

Maybe we can leave out the "types = 'widget'" part, and assume it's a widget if there's a "widget = '...'" argument.

Perhaps an actual skang.widget.button(), or even a widget.button().

]]