Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Member Since 24 Sep 2013
Offline Last Active Nov 14 2013 02:34 AM

Topics I've Started

How to get the full declaration of a local variable in context

19 October 2013 - 11:17 AM

Hi, I want to get the full declaration (something like: const namespace::array<object> a;) of a local variable in context.


I tried function->GetVarDecl(), but it does not full (no namespace, no <object>). I know namespace can be found in engine->GetObjectTypeById()->GetNamespace(), and const can be found in function->GetVarDecl() but how to get the template subtype?


Since the template subtype can also be a template and have const and reference/handle, it seems to be a iterative process to get the full declaration. Is there a simple way to do that?


Thanks in advance!

Assign object handle to array element

11 October 2013 - 12:58 AM

I am a bit confused about how to use object handle. Here is the code example I was trying to compile with the add-on array:

class Obj {
  int x;

void main() {
  array<Obj@> a(3);
  Obj o;
  o.x = 10;
  a[0] = @o;

The compile error is "Can't implicitly convert from 'Obj@const&' to 'const Obj&'." for the assign line.

What is the correct way of doing that?


Progressive compiling

07 October 2013 - 12:08 AM

Hi, here is the problem I want to find a solution. I want to dynamically edit a script file A, so I need to compile it again and again and see the running result. A requires some common functions and global variables that are stable and no need to change, more importantly, it always needs some data that need some time to calculate. Say these dependent function and variables are stored in script B. So it's better to load B first and let it do the calculation to prepare data and then load A to run it. In this way A can be changed and run without recalculate data in B. However I found that if there is some errors in A which makes the module fail to build, the modules will be "damaged" and those function/variables in B will also be destroyed and that will be contradicted to my initial purpose of doing so. Since all script entities are in modules, I cannot make them global. And right now importing global variable from another module is not supported. So is there any good solution to this? Thank you very much!

Internal value of bool?

04 October 2013 - 08:51 AM

I am just met trouble of use c++ to access bool value in angelscript. There is no SetArgBool or GetReturnBool, and it said bool is 8bit in the document. So I used *(bool*)GetAddressOfReturnValue() but it turned out wrong.


I looked at the memory, it seemed that true is 0 and false is 255 in byte. If so, that is different from c++ tradition (as far as I can remember, in c++ 0 is false and all others are true), and it should be documented or provide set and get function.

Error: Type is still used by function?

30 September 2013 - 10:55 AM

When engine is destructed, I got a error message saying "type string is still used by function erase". It seems that a the function is holding a reference to a type. It's true that the input parameter of function erase is string, but it never addref it.


What could be the problem?