Changes between Version 2 and Version 3 of Packages/LUA


Ignore:
Timestamp:
Aug 23, 2011, 12:50:25 AM (9 years ago)
Author:
Scotty Smith
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Packages/LUA

    v2 v3  
    4343        )
    4444        {
    45           char** program = calloc (2, sizeof(char*));
    46          
    47           //program[0] is the string name of the executing executable.
    48           program[0] = "''program.exe''";
    49          
    50           _Lua_main(1, program);
     45          _Lua_spawn_shell();
    5146        }
    5247</tt>
     48
     49= Spawning a RTEMS Shell =
     50
     51This creates a lua shell that allows for the execution of RTEMS commands.
     52<tt>
     53        #include <rtems/lua.h>
     54        #include <rtems/lualib.h>
     55        #include <rtems/lauxlib.h>
     56                   
     57        rtems_task Init(
     58          rtems_task_argument ignored
     59        )
     60        {
     61          _Lua_spawn_RTEMS_shell();
     62        }
     63</tt>
     64
    5365= Executing a Standalone Lua Script =
    5466
     
    6880        )
    6981        {
    70           char** program = calloc (2, sizeof(char*));
    71        
    72           //program[0] is the string name of the executing executable.
    73           program[0] = "program.exe";
    74          
    75           //program[1] is the path to the lua script to execute
    76           program[1] = "lua_script.lua";
    77          
    78           _Lua_main(2, program);
     82          char** program_args = NULL;
     83          /*
     84             Setup arguments for the lua script, if any
     85          */
     86          _Lua_run_script("path-to-program.lua", num_arguments, program_args);
    7987        }
    8088</tt>