开发者

AngelScript, how to load a script file?

开发者 https://www.devze.com 2023-03-20 10:41 出处:网络
I know how I can bind C++ functions to AngelScript, but in my C++ code, how do I load an .as script file? How can I say in my C++ \"Execute myscript.as now!\" ?

I know how I can bind C++ functions to AngelScript, but in my C++ code, how do I load an .as script file? How can I say in my C++ "Execute myscript.as now!" ?

In the AngelScript API I don't find any funct开发者_如何学运维ion like "LoadScript" or "ExecuteScript". Or do I have to define a path somewhere from where AngelScript loads all scripts and I don't need to tell it the exact files?


Just found it out (in a small side sentence in the docs):

AngelScript doesn't provide a build in file loading. That's why there is no API function. So the manual loading is indeed the only way.


asIScriptModule::AddScriptSection will load a script string. asIScriptContext::Execute will execute a function from a script. The documentation was pretty clear about all of this; you might want to give it a look.

0

精彩评论

暂无评论...
验证码 换一张
取 消