- set_libraries(lua_state);
- char cmd_name[32];
- int len = 0;
- memset(cmd_name, 0, 32);
- sscanf(Cmd, "%31s%n", cmd_name, &len);
+
+ //Sets the pm3 core libraries, that go a bit 'under the hood'
+ set_pm3_libraries(lua_state);
+
+ //Sets the 'command line' libraries, basically just the commandline stuff
+ set_cmdlibraries(lua_state);
+
+ //Add the 'bin' library
+ set_bin_library(lua_state);
+
+// char cmd_name[32];
+// memset(cmd_name, 0, 32);
+// sscanf(Cmd, "%31s%n", cmd_name, &len);
+
+ char script_name[128] = {0};
+ char arguments[256] = {0};
+
+ int name_len = 0;
+ int arg_len = 0;
+ sscanf(Cmd, "%127s%n %255[^\n\r]%n", script_name,&name_len, arguments, &arg_len);
+
+ char *suffix = "";
+ if(!endsWith(script_name,".lua"))
+ {
+ suffix = ".lua";
+ }