Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 04 Oct 2012
Offline Last Active May 23 2013 08:17 AM

Topics I've Started

Type-Casting single reference types

10 December 2012 - 11:05 AM


I have a couple of objects that I currently introduce as single reference types into the scripting environment. This is because they are in-place allocated in a special memory manager. They obviously do not have any ref counting behaviours, either.

Now the management class only handles base pointers to the class hierarchy. I would like to create casting behaviours in AS now so that I can safely cast the types up and down the hierarchy.

I am not able to register the type casting like it is documented in the Class Hierarchies chapter of the manual. Returning by value is obviously wrong, returning by @ is equally wrong since there is no ref counting. Returning by & returns an error when I try to register the type cast.

Any ideas or hints on what I could also do?


16 Byte Alignment on Value Types

10 October 2012 - 03:57 AM


I need a 16 byte alignment on certain value types to accurately mirror value classes we pass into our interface. I've tried overloading the memory allocator but that does not seem to work, I still get unaligned addresses for value types created by AngelScript.
I noticed there is an 8 byte alignment flag, but that does not seem to do anything at all.

Could you point me to where I can modify this and turn the 8byte into a functional 16 byte alignment flag?


Section names and reloading

04 October 2012 - 05:19 AM


I have a usage scenario for AngelScript and would like to ask if that is possible at all and what the best way to do it is:

I believe I have the easy steps figured out (but am open to suggestions):
- I register a set of interfaces with the scripting engine so the scripts can interact with my systems
- The scripts are going to be script classes that implement a set of event methods set by a specific interface (like onUpdate or onSetup)
- Although many different instances of those script classes exist, only one of the event methods run at a time.
- The system loads presets that reference script code. I would ideally have this script code in binary form when I load it.

The hard part would be:
- During developement of the presets, I would ideally be able to unload the script class definition for one preset and reload it with the updated code.

The main problem is that there will most likely be 300-400 of those presets active at one time, and only a hand full share the same script class so only those would need reloading. I traced AddScriptSection for a bit and found that although it uses a string table and index for the naming, the index itself is not really used and sections with the same name would be added more than once. I also found no way to unload a section, either.

Thanks for helping!