Advertisement

static function in script class

Started by July 14, 2006 12:42 AM
5 comments, last by soarwell 18 years, 4 months ago
Can i define a static function in script class? like this //script class someclass { static void dosomething() { } }
no actually angelscript doesn't support neither static functions nor static properties of the classes. the only way is to make them global functions. i've asked andreas about this cause is a very useful feature to have, and will help a lot reflecting straight c++ classes without any sort of wrapping...
Advertisement
It's not a big issue. All it affects is the function's name. A static method has the exact same linkage as a global function, it's just in a different scope.

namespace foo{   void bar();}


is equivilant to

class foo{public:   static void bar();}


I don't see how this could affect how you bind stuff at all, beyond the name the function has in angelscript.
Sometime in the future I may add support for static members in script classes, but for now I consider it a low priority feature.

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

thanks all.
WitchLord:
can you add unicode support for as?
here 'unicode' i mean utf16,we can write script use utf16.
API:
AddScriptSection(const wchar_t *module, const wchar_t*name, const wchar_t*code, size_t codeLength, int lineOffset = 0, bool makeCopy = true)

now i can but use utf8 to write script,and convert utf8 to utf16 to do some work in application,it's inefficient i think.

I can't quite figure out why you would need the scripts written in utf16. Do need to include a lot of unicode string constants in the scripts, is that it? Wouldn't it be better to solve this through a separate resource loader that the scripts can access?

I'll look into how much effort it would take to support both utf8 and utf16 scripts.

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

Advertisement
For program,utf16 is easyly to process,like calculate string length...
utf16 is very concordant on windows nt(2000,xp,2003) platform
we need utf16 when developing the multinatinal project,
and our library,engine is develpoed use utf16
and ,and someguy like write string in script files,oh my god,i can't stop him to do this,beacuse he have writen very very much script files.

thanks
soarwell

This topic is closed to new replies.

Advertisement