Browse Source

Modify xml-examples/lua/*.xml in order to make the default ACTION handler Lua. Leave a command (test1) which uses the clish_script@clish handler just to illustrate how Lua and shell ACTIONs can co-exist

Stanislav Galabov 11 years ago
parent
commit
5d18567db0
2 changed files with 8 additions and 4 deletions
  1. 3 1
      xml-examples/lua/startup.xml
  2. 5 3
      xml-examples/lua/test.xml

+ 3 - 1
xml-examples/lua/startup.xml

@@ -7,7 +7,9 @@
      <PLUGIN name="lua" file="clish_plugin_lua.so">
 	 /usr2/klish-rw/xml-examples/lua
      </PLUGIN>
-     <STARTUP view="test-view" default_builtin="lua@lua"/>
+     <HOOK name="action" builtin="lua@lua"/>
+
+     <STARTUP view="test-view"/>
 
 </CLISH_MODULE>
 

+ 5 - 3
xml-examples/lua/test.xml

@@ -15,7 +15,9 @@
 	</COMMAND>
 
 	<COMMAND name="test1" help="" lock="false">
-		<ACTION> echo "Empty attribute" </ACTION>
+		<ACTION builtin="clish_script@clish">
+			echo "Empty attribute"
+		</ACTION>
 	</COMMAND>
 
 	<COMMAND name="test2" help='Single quotes' lock="false">
@@ -81,12 +83,12 @@ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 	</COMMAND>
 
 	<COMMAND name="test8" help="Call a Lua function">
-		<ACTION builtin="lua@lua">hello_world()</ACTION>
+		<ACTION>hello_world()</ACTION>
 	</COMMAND>
 
 	<COMMAND name="eval" help="Evaluate a string as Lua chunk">
 		<PARAM name="str" help="String to evaluate" ptype="STRING"/>
-		<ACTION builtin="lua@lua">loadstring("${str}")()</ACTION>
+		<ACTION>loadstring("${str}")()</ACTION>
 	</COMMAND>
 
 	<COMMAND name="test9" ref="eval" help="Alias for the eval command"/>