• Content count

  • Joined

  • Last visited

Community Reputation

722 Good

About TechRogue

  • Rank
  1. How is cast<T>() registered?

    I assumed that would be the case. The implicit cast trick is a good one (and I actually realized I could do it while writing this post), the only drawback is that you have to assign it before you can use the properties or methods of the Type class...though I suppose I could register the same members to both types.   That post looks great! I'll definitely check his code out. Thanks for the reply.
  2. How is cast<T>() registered?

    Just what it says in the title. I know you can't register template methods on objects, but it's recently occurred to me that cast appears to use a templated function. Is that something that's built into the language, or can it be repeated in user code?   I'm working on a few classes that expose reflection to the scripting language, and currently I've got it set up like this:   I have a Type class, which has no default factory. It requires a parameter of type __typeof. I have a Typeof class, which is registered with the engine as both __typeof and typeof<T>. typeof<T> is implicitly convertable to __typeof. __typeof has no factory defined at all, so it can only be created from an instance of typeof<T>. It's a convoluted setup, but ultimately it allows me to do this: Type myType(typeof<MyClass>()) What I'm wondering now is whether I can make a function that behaves in the same way as cast<T>(), with the end result being a syntax that looks like this: Type myType = typeof<MyClass>(); Of course, the best possible result would be to mimic C# syntax exactly, but I don't think that's possible; Type myType = typeof(MyClass);
  3. Array trailing comma

    Totally understandable -- my comment was based on the assumption that Angelscript was like every other language I've used and that a trailing comma didn't make any difference at all.
  4. Array trailing comma

    Oh, I wasn't aware of this. Very strange. I've never used another language with that behavior...sounds like it probably does more harm than good, no? You can always pass null or 0 if you want to have uninitialized elements in your array.
  5. Array trailing comma

    Why would you want that though? It has no adverse effect and just makes it easier to add new elements if you're still working on the code.
  6. AngelScript 2.29.1

    I much prefer the new syntax for named arguments. No ambiguity to worry about, and C# programmers will be right at home.
  7. AngelScript 2.28.2 is out

    Ah, very nice!
  8. AngelScript 2.28.2 is out

    Anonymous objects? Is that anything like in C#?   var obj = {     str = "a string",    num = 100 };
  9. the compiler doesn't compile the script

    I feel like running a random exe that requires UAC to be disabled is a terribly unsafe thing to do.
  10. Problem with array of handles

    I'll just chime in here and say that it isn't especially obvious what the bool parameter in find() would do. It might be clearer to name it something like findByRef(). Just my two cents.
  11. Null pointer access

    You need to use ctx->SetObject() to pass the context a pointer to the object which owns the method. The method doesn't own the object itself; it needs to know which instance to be called on.
  12. AngelScript 2.27.1 is here (so soon? yes)

    Is there any chance that the same syntax could eventually be used to register variadic function definitions?
  13. AngelScript 2.27.1 is here (so soon? yes)

    Nice! I like it a lot. I'm stuck in C# for my current language so I've had to use Lua (ugh), but I'm looking forward to getting back to C++ and playing around with the features you've added since I've been gone.
  14. AngelScript 2.27.1 is here (so soon? yes)

    The void expression sounds interesting. Would that be something like this? bool GetInventoryItem(string name, out Item@ item) { // if item exists, pass it out and return true // else return false } // ... if (GetInventoryItem("map", void)) { // we have the map but don't care about using it at the moment } I can't find any mention of it in the documentation, although that's probably since it's such a new feature that you haven't updated it yet.
  15. Initialization List

    I think something like this was mentioned a while back, but it wasn't decided for or against. I'd also be interested in this feature, especially for initializing Dictionary types with key/value pairs.