Jump to content

making use of windows api


photo

Recommended Posts

You can use Variable type or any build in type (float,int). Please, see the following sample: Samples/Api/Functions/Function.cpp


/*
*/
Variable my_sum(const Variable &v0,const Variable &v1) {

if(v0.getType() == Variable::INT && v1.getType() == Variable::INT) {
	Log::warning("my_sum(%d,%d): called\n",v0.getInt(),v1.getInt());
	return Variable(v0.getInt() + v1.getInt());
}

if(v0.getType() == Variable::STRING && v1.getType() == Variable::STRING) {
	Log::warning("my_sum(%s,%s): called\n",v0.getString(),v1.getString());
	return Variable((std::string(v0.getString()) + "+" + std::string(v1.getString())).c_str());
}

Log::warning("my_sum(%s,%s): called\n",v0.getTypeName(),v1.getTypeName());

return Variable("unknown");
}

  • Like 1
Link to comment
×
×
  • Create New...