Skip to main content
GameDev.net gamedev.net
🔒 Locked

Default namespaces in opCast

Started by johannesg Sep 28, 2025 at 10:38 AM 3 replies 1.3k views
Original Post
johannesg
johannesg

I'm doing this:

class io_channel;
class connection: public io_channel;

engine.RegisterObjectType ("io_channel", 0, asOBJ_REF);
engine.SetDefaultNamespace ("visa");
engine.RegisterObjectType ("connection", 0, asOBJ_REF);
engine.RegisterObjectMethod ("connection @opCast(io_channel @)", …);

This gets me this error message:

System function (line 1, column 1): Identifier 'connection' is not a data type in global namespace

Instead I need to do this:

engine.RegisterObjectMethod ("visa::connection @opCast(io_channel @)", …);

In other words, I need to manually add the namespace here, despite the code running after a call to SetDefaultNamespace. Is this behaviour intentional, or is it a (small) bug?

The namespace is optional when the classname is used as an argument:

engine.RegisterObjectMethod ("io_channel @opImplCast(connection @)", …);
WitchLord
WitchLord

This looks like a bug. I'll investigate it.

Regards,
Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - <a href="http://www.angelcode.com/tower" rel
WitchLord
WitchLord

I've tested this with the latest WIP version and it is working as expected.

What version of AngelScript are you currently using? Can you try the latest WIP version?

https://github.com/anjo76/angelscript/commit/10c2707e5b2cc23c1025a2a43a8a02b6a929a8bc

Regards,
Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - <a href="http://www.angelcode.com/tower" rel
johannesg
johannesg

Ooh, I didn't include version information. Feel like such a n00b now 😅

I am currently still using version 2.37.0. I know 2.38 is out, but haven't had a chance to upgrade yet.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.