脚本引擎RapScript V0.0.0.1发布

这是最近完成的RapScript的0.0.0.1版的源代码。
这份代码目前比较糟糕,有点乱,而且没有错误处理,但开源是一种习惯。。。

先介绍一下怎么用:
把RapScript.h RapScript.cpp RapStack.h加入工程,然后在自己的main.cpp里加入
#include " RapScript.h "

RapScript XXX;

XXX是对象名,可以自己取。

关于函数互交:
比如说,你在C++中写了一个函数:
void test( int a, int b)
{
cout
<< " In void test(int a,int b) a: " << a << " b: " << b << endl;
}
要调用它,要在写一个:
void rap_test()
{
int a = rapscript.para[ 0 ].v_int; // 参数一
int b = rapscript.para[ 1 ].v_int; // 参数二
test(a,b);

}
然后在合适的位置(比如int main()中)加入
rapscript.tmp_cmd.cmd_name = " test " ;
rapscript.tmp_cmd.v_type
= rapscript.CMD_VOID;
rapscript.tmp_cmd.fp_void
= rap_test;
rapscript.cmd_list.push_back(rapscript.tmp_cmd);
调用rapscript.run_rap();
脚本就会执行了。
说明一下:
1.在脚本中写命令时要这样:test(a;b;);//我偷懒了
2.所有变量用前必须声明(如int a;string b;)
目前只支持int 和 string
3.Bug超多。
4.if()和 for()等暂时不支持
5.如果你愿意修改源代码,只要合理,就会被采用,名字也会加入Author里。。。

下载RapScript V0.0.0.1源代码
┏━┓   ┏━━┓   ┏┓     
┃┃┣━┳━┫━━╋━┳┳╋╋━┳━━┓
┃ ┫━┃┃┣━━┃┣┫┏┫┃┃┣┓┏┛
┗┻┻┻┫┏┻━━┻━┻┛┗┫┏┛┗┛ 
              ┗┛        ┗┛    
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值