--load external libraries: this one creates the evar table
require( "vars" );

--call this with !lslua_test
function bang_lslua_test()
    --comments
    --[[ multi line
         comments ]]
    local my_string = "more stuff";
    local a_number = 5;
    if ( a_number ~= 6 ) then
        a_number = a_number + 1;
    end
    while ( a_number <= 100 ) do
        a_number = a_number * 2;
    end
    another_number, number_three = 2, 5;
    message_box( "stuff" );
    message_box( my_string );
    message_box( "$LiteStepDir$ = " .. ls.LiteStepDir:toString() );
    message_box( do_some_calculations( a_number, 4.23 ), "Calculating... " );
    message_box( "\"This is a message box with quotes\"", "title" );
    exec( ls.Browser:toString() );
    exec( ls.LiteStepDir:toString() .. "step.rc" );
    exec( "\"explorer\" /e,c:\\" );
    exec( "explorer", "/e,c:\\Program Files\\" );
    exec( "!alert", "message", "title" );
    exec( "!about" );
    --message_box can have embedded quotes
end

--bangs can take arguments now! its just one big string that contains
--the entire argument string for now... hopefully soon there will be
--a tokenizer as something you can require()... we shall see.
function bang_bang_with_args( args )
    for word in string.gfind( args, "%a+" ) do
        message_box( word );
    end
end

--you can define functions that don't get turned into bangs
function do_some_calculations( n, m )
    return n + m / 2;
end

function quote( string )
    return "\"" .. string .. "\"";
end

--any lua commands not in a function will be executed on module load
--like *Script start
--bang_lslua_test()
--these were not declared local in bang_lslua_test()
--message_box( another_number .. " " .. number_three );
--exec( "!alert \"This is a LiteStep !alert\"" );
--message_box( "This is an LSLua message_box()" );
