Created
November 19, 2012 10:08
-
-
Save cnd/4109956 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
///<Summary> | |
///Load list of config files | |
///</Summary> | |
case 0xB0: { | |
unsigned char bytes[] = { 0x0A, 0xB0 }; | |
LString luafile; | |
LBytes lselect = (message.extract(2, sizeof(int))); | |
int lsel = 0; | |
memcpy(&lsel, lselect.ptr(), sizeof(int)); | |
cout << lsel << " "; | |
switch ( lsel ) { | |
case 0: luafile = "lua/example.lua"; break; | |
case 1: luafile = "lua/example2.lua"; break; | |
} | |
cout << luafile << endl; | |
ifstream f(luafile); | |
f >> noskipws; //don't want to skip spaces ! | |
//initialize a vector with a pair of istream_iterators | |
vector<unsigned char> v((istream_iterator<unsigned char>(f)), | |
(istream_iterator<unsigned char>())); | |
LBytes lexing = (LBytes(bytes, 2)); | |
lexing += lselect; | |
lexing += (LBytes(v.data(), v.size())); | |
f.close(); | |
return lexing; | |
} break; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment