]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/scripting.c
Reworked how to call 'standard' stuff from within lua scripts, so now it's much simpl...
[proxmark3-svn] / client / scripting.c
index ae11d7caacbea057bb3ab4999e131d3a861db96a..9e3ff4e35306c72c5805517d37ef618aa3e8733c 100644 (file)
@@ -136,6 +136,18 @@ static int l_ukbhit(lua_State *L)
     lua_pushboolean(L,ukbhit() ? true : false);
     return 1;
 }
+/**
+ * @brief Calls the command line parser to deal with the command. This enables
+ * lua-scripts to do stuff like "core.console('hf mf mifare')"
+ * @param L
+ * @return
+ */
+static int l_CmdConsole(lua_State *L)
+{
+    CommandReceived((char *)luaL_checkstring(L, 1));
+    return 0;
+}
+
 
 /**
  * @brief Sets the lua path to include "./lualibs/?.lua", in order for a script to be
@@ -172,6 +184,7 @@ int set_pm3_libraries(lua_State *L)
         {"foobar",                      l_foobar},
         {"ukbhit",                      l_ukbhit},
         {"clearCommandBuffer",          l_clearCommandBuffer},
+        {"console",                      l_CmdConsole},
         {NULL, NULL}
     };
 
Impressum, Datenschutz