From ae15c08a2205c5934bee8f1ee942180be402c32f Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Thu, 20 Mar 2014 14:33:53 +1000 Subject: Move skang specific notes inte skang.lua. --- ClientHamr/GuiLua/GuiLua.c | 81 +-------------------------------------------- ClientHamr/GuiLua/skang.lua | 52 +++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 80 deletions(-) (limited to 'ClientHamr') diff --git a/ClientHamr/GuiLua/GuiLua.c b/ClientHamr/GuiLua/GuiLua.c index e0efd00..2b5f161 100644 --- a/ClientHamr/GuiLua/GuiLua.c +++ b/ClientHamr/GuiLua/GuiLua.c @@ -160,86 +160,7 @@ database stuff for now, but should keep it in mind. /* skang package -In here should live all the internals of matrix-RAD that don't -specifically relate to widgets. This would include the "window" though. - -skang.module(Evas) -skang.module(Elementary) -skang.load('some/skang/file.skang') - -This package is also what "apps" that use the system should "inherit" -from, in the same way matrix-RAD apps did. Skang "apps" could be Lua -modules. They could also be C code, like the extantz modules are likely -to be. Skang "apps" would automatically be associated with skang files -of the same name. So a Lua skang "app" could look like this - - -local skang = require('skang') -local result = {}; -result.author = 'onefang' -result.version = '0.72 alpha 2004-11-19 16:28:00' -local bar --- The first argument would be the name of a local variable / method. Which could be accessed via _G? --- Not sure if we could use a global bar, AND use it directly. -result.bar = skang.newParam('bar', "Required", "Shortcut", "Default", "Help text") -result.func = skang.newCommand('arg1_type,arg2_type', 'Help Text', function (arg1, arg2) -... do something here ... -end) - -... do something here ... - -return result; - - -A basic skang file could look like this - - -#!skang myApp.skang --- There's an implied local this = require('myApp') --- There's an implied local skang = require('skang') -local widget = require('EvasWidgets') -local other = require('otherPackageName') -skang.clear -skang.window(200, 200, "G'day planet.") -quitter = widget.button('Quit', 0.5, 0.5, 0.5, 0.5) -quitter:action('quit') -- 'quit' is looked up in ThingSpcae.commands, and translated into the Lua 'skang.quit()'. -other.foo = 'stuff' -this.bar = other.foo -this.func(1, 'two') - -The skang command (written in C) would strip off the first line, add the -two implied lines, then run it as Lua. The skang.load() command would -do the same. So that skang C comand would just pass the file name to -skang.load() in this library. B-) - - -The old skang argument types are - - - {"name", "java.lang.String"}, - {"action", "java.lang.String"}, - {"type", "java.lang.String"}, - {"data", "java.lang.String"}, - {"URL", "java.lang.String"}, - {"file", "java.lang.String"}, - {"method", "java.lang.String"}, - {"lx", "java.lang.String"}, - {"ly", "java.lang.String"}, - {"lw", "java.lang.String"}, - {"lh", "java.lang.String"}, - {"normal", "java.lang.String"}, - {"ghost", "java.lang.String"}, - {"active", "java.lang.String"}, - {"toggle", "java.lang.String"}, - {"boolean","java.lang.Boolean"}, - {"number", "java.lang.Integer"}, - {"int", "java.lang.Integer"}, - {"x", "java.lang.Integer"}, - {"y", "java.lang.Integer"}, - {"w", "java.lang.Integer"}, - {"h", "java.lang.Integer"}, - {"r", "java.lang.Integer"}, - {"g", "java.lang.Integer"}, - {"b", "java.lang.Integer"}, - {"alpha", "java.lang.Integer"}, - {"acl", "net.matrix_rad.security.ACL"}, +Currently this is in skang.lua, but should bring this in here later. */ diff --git a/ClientHamr/GuiLua/skang.lua b/ClientHamr/GuiLua/skang.lua index 25aedac..1b0a199 100644 --- a/ClientHamr/GuiLua/skang.lua +++ b/ClientHamr/GuiLua/skang.lua @@ -1,3 +1,55 @@ +-- TODO - This should be in C, but so far development has been quite rapid doing it in Lua. +--[[ +In here should live all the internals of matrix-RAD that don't +specifically relate to widgets. This would include the "window" though. + +skang.module(Evas) +skang.module(Elementary) +skang.skang('some/skang/file.skang') + +This package is also what "apps" that use the system should "inherit" +from, in the same way matrix-RAD apps did. Skang "apps" could be Lua +modules. They could also be C code, like the extantz modules are likely +to be. Skang "apps" would automatically be associated with skang files +of the same name. + +For a .skang file, the skang command (written in C) would strip off the +first line, add the two implied lines, then run it as Lua. The +skang.load() command would do the same. So that skang C comand would +just pass the file name to skang.load() in this library. B-) + +The old skang argument types are - + + {"name", "java.lang.String"}, + {"action", "java.lang.String"}, + {"type", "java.lang.String"}, + {"data", "java.lang.String"}, + {"URL", "java.lang.String"}, + {"file", "java.lang.String"}, + {"method", "java.lang.String"}, + {"lx", "java.lang.String"}, + {"ly", "java.lang.String"}, + {"lw", "java.lang.String"}, + {"lh", "java.lang.String"}, + {"normal", "java.lang.String"}, + {"ghost", "java.lang.String"}, + {"active", "java.lang.String"}, + {"toggle", "java.lang.String"}, + {"boolean","java.lang.Boolean"}, + {"number", "java.lang.Integer"}, + {"int", "java.lang.Integer"}, + {"x", "java.lang.Integer"}, + {"y", "java.lang.Integer"}, + {"w", "java.lang.Integer"}, + {"h", "java.lang.Integer"}, + {"r", "java.lang.Integer"}, + {"g", "java.lang.Integer"}, + {"b", "java.lang.Integer"}, + {"alpha", "java.lang.Integer"}, + {"acl", "net.matrix_rad.security.ACL"}, +]] + + -- Trying to capture best practices here for creating modules, especially since module() is broken and deprecated. -- Wrapping the entire module in do .. end helps if people just join a bunch of modules together, which apparently is popular. -- cgit v1.1