Advertisement

Problems with exposing a class as global

Started by July 06, 2007 02:27 PM
10 comments, last by _Sigma 17 years, 4 months ago
You need to tell AngelScript:
"bool IsKeyDown(const string ∈)" to tell AngelScript to pass the string as a constant reference (for use as input)

You need to have the C++ function as:

bool TInput::IsKeyDown(const asCScriptStruct *str)
or
bool TInput::IsKeyDown(const asCScriptStruct &str)

because asCScriptStruct is the [default, unless you wrote your own] way AngelScript passes strings back to C++. It's const, because you registered the function with AngelScript as const -- and of course it's a reference/pointer.


I DO know you registered the original IsKeyDown with AngelScript wrong (you said "string key" instead of "string ∈" or "const string ∈". You never posted what you were using for the C++ of IsKeyDown, so I took a guess that you had that wrong, which caused the compiler to handle the arguments being passed to the function (from AngelScript) wrong -- which caused the stack problems.
so all string should be passed in as reference? I've never had a problem with this before...O_o

This topic is closed to new replies.

Advertisement