I am having some trouble getting a small script to build using 2.4.1. I am beginning the process of integrating AngelScript with my application, and I am just trying to get a basic script up and running.
The script is:
void OnLoad(int x)
{
int i;
i = x;
}
And I am using the following code to load the script:
ifstream file;
file.open("test.as");
if(!file.good())
m_Log->logMessage("Could not open script file");
file.seekg(0, ios::end);
int len = file.tellg();
file.seekg(0, ios::beg);
string code = "";
code.resize(len);
file.read(&code[0], len);
file.close();
m_ScriptEngine->SetCommonMessageStream(new LogOutput(m_Log));
m_ScriptEngine->AddScriptSection(NULL, "script", &code[0], len, 0, false);
int r = m_ScriptEngine->Build(NULL);
if(r < 0)
m_Log->logMessage("Could not build script");
I get the following message in my log file:
13:40:58: script (6, 1) : Error : Unexpected token '<unrecognized token>'
Line 6 is an empty line, it's just the line after the CR/LF at the end of line 5. It's a very odd error. Does AS not properly handle CR/LF (Windows style) line endings? Or empty lines? Or am I missing something entirely?
[Edited by - Calefaction on October 11, 2005 4:34:07 PM]
Matt Holmes[ aka Calefaction ]Wildfire Games - General Programmerhttp://www.wildfiregames.com