Advertisement

New to Angel! Fail to define a function

Started by February 01, 2024 03:36 PM
1 comment, last by WitchLord 9 months, 3 weeks ago

I have a basic c++ Angel console embedded.
I can to some simple print( … ). So something must be right.
But the following script fails in my test script:
void function(){ print( "funtion"); }
with:
ExecuteString (6, 6) : ERR : Expected ';'
ExecuteString (6, 6) : ERR : Instead found identifier 'function'

I suspect I must have some basic registration missing. Any ideas?
/conrad

Follow-up:
Ok, I guess I made some bad assumptions.
I have been testing embedding script engines up to a level I want for C++/Script interoperability.
I got Wren, Lua, ZetScript and Chai done.
Angel seem to take a different approach. I needed to make a distinction between script statements that are executable with ExecuteString(..) and script code that needs compilation with CScriptBuilder and CContextMgr, with section and module etc
I have something working now.
That said, I still think I may be missing some basic point - time will show.
/conrad

Hi Conrad,

If you haven't already done so, I suggest you take a look at the ‘console’ sample. It shows you can implement a simple console that allows declaring new functions from a console entry.

https://angelcode.com/angelscript/sdk/docs/manual/doc_samples_console.html

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