Passing char[] or char*

Started by
4 comments, last by WitchLord 17 years, 11 months ago
I was wondering if there is a way of passing char* or char[] to AS. The existent std::string class seems to be a little bit overloaded with that streaming calls. // cpp long System::SetProc(const char* , const char* ) { } ... r = ps->RegisterObjectMethod("System", "long SetProc(const char*, const char*)", asMETHOD(System,SetProc),asCALL_THISCALL); //script int Main(System sys) { sys.SetProc("sysenv.as", "SystemProc"); }
MCO
Advertisement
What is an AS? I'm pretty sure you don't mean Autonomous System...
I really hate when people follow links off the front page and don't bother to pay attention to what forum the thread is in.

As for the question; use std::string. If you find it's a bottle neck later (after extensive profiling, of course; and it won't be a bottle neck) then look for other solutions.
You can create your own wrapper around "char*" and register is as a new string class for AS (lite std::string if you prefer).
Quote:Original post by Deyja
I really hate when people follow links off the front page and don't bother to pay attention to what forum the thread is in.


Point taken. Sorry, I'm new here...
Don't be so harsh, Deyja. I just think it is funny. :)

Hanatarou: If you didn't figure it out yet; AS is short for AngelScript, which in turn is short for AngelCode Scripting Library.

---

Currently the easiest way, in my opinion, is to write wrapper functions for those functions that take const char pointers.

I do have plans however to let AngelScript use a registered method that will convert the registered string type to const char*, and vice versa. This way you'll be able to register these functions directly. I'm not sure when I will get around to implementing that however.

Regards,
Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement