diff --git a/elua/Makefile.am b/elua/Makefile.am new file mode 100644 index 00000000..63d102da --- /dev/null +++ b/elua/Makefile.am @@ -0,0 +1,17 @@ +if HAVE_ELUA + +MAINTAINERCLEANFILES = Makefile.in + +DATA_FILES = Makefile.examples +EXTRA_DIST = $(DATA_FILES) + +install-examples: + mkdir -p $(datadir)/elua/examples + $(install_sh_DATA) -c $(DATA_FILES) $(datadir)/elua/examples + +uninstall-local: + for f in $(DATA_FILES); do \ + rm -f $(datadir)/elua/examples/$$f ; \ + done + +endif diff --git a/elua/elm_test.lua b/elua/elm_test.lua new file mode 100644 index 00000000..77076d48 --- /dev/null +++ b/elua/elm_test.lua @@ -0,0 +1,38 @@ +local win = elm.Window("test", "Hello World") + +win:smart_callback_add("delete,request", function() + elm.exit() +end) + +local bg = elm.Background(win) +bg:size_hint_weight_set(1.0, 1.0) +win:resize_object_add(bg) +bg:show() + +local bx = elm.Box(win) +bx:size_hint_weight_set(1.0, 1.0) +win:resize_object_add(bx) +bx:show() + +local lbl = elm.Label(win) +lbl:text_set("Lua runtime test") +bx:pack_end(lbl) +lbl:show() + +local counter = nil +local step = 5 + +local btn = elm.Button(win) +btn:text_set("Reset counter") +bx:pack_end(btn) +btn:smart_callback_add("clicked", function() + if not counter then + btn:text_set("Add " .. step) + end + counter = counter and (counter + step) or 0 + lbl:text_set(tostring(counter)) +end) +btn:show() + +win:resize(360, 360) +win:show() \ No newline at end of file