Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Dinkleberg

  • Rank

Personal Information

  • Interests
  1. Does Angelscript catch null pointer exceptions? I didn't know that. That would imply that the crashes I've been getting are access violations from the dll, not from my script.
  2. void f(array<int> a = {9}) { print(a[0]); // prints '0' (expected '9') } void id() { f(); } Angelscript 2.32.0
  3. Ah yes thank you. I'm not sure if this is a bug, but when I call a method of a null object, execution of the script stops completely with no error: class MyClass { void foo() {} } void id() { print('marco '); MyClass a = null; a.foo(); print(' polo'); // never reached, no error } I'm also executing the script from inside a dll-proxied monstrosity, so I'm not sure how this snippet would behave in a more normal setting.
  4. Why does this script error? What's the correct way to write a boilerplate opAssign? (You can probably tell I'm not too experienced with C++.) class MyClass { int x; MyClass(int x) { this.x = x; } MyClass opAssign(const MyClass &c) { x = c.x; return this; } } I tried adding an empty default constructor (MyClass() {}) and that made it compile but enter an infinite loop when opAssign is called. I don't want to have a default constructor (that means constructor with no arguments?), it doesn't make sense to have a default value for x in my domain.
  5. Dinkleberg

    [SOLVED] How to pass global function as callback?

    Okay, now how do I get this to work? bool weaker(const Info@ &in a, const Info@ &in b) { return a.hp < b.hp; } array<const Info@> attackableEnemiesByHp() { array<const Info@> attackable_enemies = attackableEnemies(); attackable_enemies.sort(weaker); // ERROR No matching signatures return attackable_enemies; } Info is a class representing an entity in the game.
  6. Following the example from the docs, this works: array<int> arr = {3,2,1}; arr.sort(function(a,b) { return a < b; }); I would expect the following to work: bool less(int a, int b) { return a < b; } ... array<int> arr = {3,2,1}; arr.sort(less); but instead it errors: ERROR : No matching signatures to 'array::sort(::less)' INFORMATION : Candidates are: INFORMATION : void array::sort(less&in, uint startAt = 0, uint count = uint ( - 1 )) How do I pass array.sort an existing function instead of an anonymous function? I'm using Angelscript 2.32.0
  7. I have a type registered as so: ScriptEngine->RegisterObjectType("Object",0,asOBJ_REF|asOBJ_NOCOUNT); Then in my script I have this code: array<Object@> ret = {}; const Object@ x = @game.objects[i]; ret.insertLast(x); Which gives the error: ai\9.as(162, 13): ERROR : No matching signatures to 'array::insertLast(const Object@&)' ai\9.as(162, 13): INFORMATION : Candidates are: ai\9.as(162, 13): INFORMATION : void array::insertLast(Object@const&in) What does this mean? What's the difference between const Object@ and Object@const? I'm sorry I don't know offhand what version of Angelscript I'm using, because someone else compiled it for me a few years ago.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!