Changeset 367 for trunk/src/lua


Ignore:
Timestamp:
05/16/15 23:12:22 (10 years ago)
Author:
epyon
Message:
  • fixed compilation and warnings on gcc
  • slowly removing/merging external includes
Location:
trunk/src/lua
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lua/lua_aux.cc

    r319 r367  
    77#include "nv/lua/lua_aux.hh"
    88
    9 #include <utility>
    109#include "nv/lua/lua_raw.hh"
    1110#include "nv/core/random.hh"
     
    117116                        int arg1 = static_cast< int >( luaL_checkinteger( L, 1 ) );
    118117                        int arg2 = static_cast< int >( luaL_checkinteger( L, 2 ) );
    119                         if (arg2 < arg1) std::swap( arg2, arg1 );
    120                         lua_pushinteger( L, nv::random::get().srange( arg1, arg2 ) );
     118                        int result = ( arg2 >= arg1 ? nv::random::get().srange( arg1, arg2 ) : nv::random::get().srange( arg2, arg1 ) );
     119                        lua_pushinteger( L, result );
    121120                }
    122121        }
  • trunk/src/lua/lua_state.cc

    r365 r367  
    356356}
    357357
    358 int lua::state::load_stream( std::istream& stream, string_ref name )
    359 {
    360         NV_LOG_NOTICE( "Loading Lua stream '", name, "'");
    361         return load_string( std::string(
    362                 (std::istreambuf_iterator<char>(stream)),
    363                 std::istreambuf_iterator<char>()), name );
    364 }
    365 
    366358int lua::state::load_file( string_ref filename )
    367359{
     
    380372        }
    381373        return do_current( name, rvalues ) == 0;
    382 }
    383 
    384 bool lua::state::do_stream( std::istream& stream, string_ref name )
    385 {
    386         lua::stack_guard( this );
    387         int result = load_stream(stream,name);
    388         if (result)
    389         {
    390                 NV_LOG_WARNING( "Failed to open stream ", name, ": ", lua_tostring( m_state, -1 ) );
    391                 return false;
    392         }
    393         return do_current( name ) == 0;
    394374}
    395375
Note: See TracChangeset for help on using the changeset viewer.