Changeset 220 for trunk/src/lua


Ignore:
Timestamp:
12/17/13 23:57:51 (12 years ago)
Author:
epyon
Message:
  • nv::lua - lua_raw byte array function (probably should be templated or other versions added)
File:
1 edited

Legend:

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

    r162 r220  
    248248        }
    249249}
     250
     251std::vector<nv::uint8> nlua_tobytearray( lua_State *L, int index )
     252{
     253        index = lua_absindex( L, index );
     254        std::vector<nv::uint8> result;
     255        if ( lua_istable( L, index ) )
     256        {
     257                lua_pushnil( L );
     258                while ( lua_next( L, index ) != 0 )
     259                {
     260                        result.push_back( (nv::uint8) lua_tointeger( L, -1 ) );
     261                        lua_pop( L, 1 );
     262                }
     263        }
     264        return result;
     265}
Note: See TracChangeset for help on using the changeset viewer.