2020-10-08 22:32:07 +08:00
|
|
|
definitions:
|
|
|
|
# the names of the functions - we use this to generate the code and to register the functions in
|
|
|
|
# the javascript class
|
|
|
|
ifunction: "lua_${generator.prefix}_${class_name}_${func_name}"
|
|
|
|
sfunction: "lua_${generator.prefix}_${class_name}_${func_name}"
|
|
|
|
constructor: "lua_${generator.prefix}_${class_name}_constructor"
|
|
|
|
conversions:
|
|
|
|
# some times you want to use a special native type when converting from spidermonkey to native
|
|
|
|
# the most common case would be from JS-boolean to bool. Using "bool" will fail here since we
|
|
|
|
# pass the address to the conversion method, and a JSBool is defined as an integer in spidermonkey
|
|
|
|
native_types:
|
|
|
|
float: "double"
|
|
|
|
short: "int32_t"
|
|
|
|
"unsigned char": "uint16_t"
|
|
|
|
"char": "int32_t"
|
|
|
|
ns_map:
|
|
|
|
"cocos2d::experimental::ui::": "ccexp."
|
|
|
|
"cocos2d::experimental::": "ccexp."
|
|
|
|
"cocos2d::extension::": "cc."
|
|
|
|
"cocos2d::ui::": "ccui."
|
|
|
|
"cocos2d::": "cc."
|
|
|
|
"spine::": "sp."
|
|
|
|
"cocostudio::timeline::": "ccs."
|
|
|
|
"cocostudio::": "ccs."
|
|
|
|
"cocosbuilder::": "cc."
|
|
|
|
"CocosDenshion::": "cc."
|
|
|
|
"cocos2d::tweenfunc::": "cc."
|
|
|
|
"cocos2d::backend::": "ccb."
|
|
|
|
|
|
|
|
to_native:
|
|
|
|
# lua to native
|
|
|
|
int: "ok &= luaval_to_int32(tolua_S, ${arg_idx},(int *)&${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
|
|
|
"unsigned int": "ok &= luaval_to_uint32(tolua_S, ${arg_idx},&${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
|
|
|
"unsigned char": "ok &= luaval_to_uint16(tolua_S, ${arg_idx},&${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
|
|
|
short: "ok &= luaval_to_int32(tolua_S, ${arg_idx},&${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
|
|
|
"unsigned short": "ok &= luaval_to_ushort(tolua_S, ${arg_idx}, &${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
|
|
|
char: "ok &= luaval_to_int32(tolua_S, ${arg_idx},&${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
|
|
|
bool: "ok &= luaval_to_boolean(tolua_S, ${arg_idx},&${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
|
|
|
float: "ok &= luaval_to_number(tolua_S, ${arg_idx},&${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
|
|
|
double: "ok &= luaval_to_number(tolua_S, ${arg_idx},&${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
2021-09-02 11:43:27 +08:00
|
|
|
ssize_t: "ok &= luaval_to_ssize_t(tolua_S, ${arg_idx}, &${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
2020-10-08 22:32:07 +08:00
|
|
|
"long long": "ok &= luaval_to_long_long(tolua_S, ${arg_idx},&${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
|
|
|
"string": "ok &= luaval_to_std_string(tolua_S, ${arg_idx},&${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
2021-04-22 22:01:47 +08:00
|
|
|
"string_view": "ok &= luaval_to_std_string_view(tolua_S, ${arg_idx},&${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
2020-10-08 22:32:07 +08:00
|
|
|
"String*": "std::string ${out_value}_tmp; ok &= luaval_to_std_string(tolua_S, ${arg_idx}, &${out_value}_tmp, \"${lua_namespaced_class_name}:${func_name}\"); ${out_value} = cocos2d::String::create(${out_value}_tmp)"
|
|
|
|
"char*": "std::string ${out_value}_tmp; ok &= luaval_to_std_string(tolua_S, ${arg_idx}, &${out_value}_tmp, \"${lua_namespaced_class_name}:${func_name}\"); ${out_value} = ${out_value}_tmp.c_str()"
|
|
|
|
"Point": "ok &= luaval_to_point(tolua_S, ${arg_idx}, &${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
|
|
|
"Vec2": "ok &= luaval_to_vec2(tolua_S, ${arg_idx}, &${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
|
|
|
"Vec3": "ok &= luaval_to_vec3(tolua_S, ${arg_idx}, &${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
|
|
|
"Vec4": "ok &= luaval_to_vec4(tolua_S, ${arg_idx}, &${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
|
|
|
"Rect": "ok &= luaval_to_rect(tolua_S, ${arg_idx}, &${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
|
|
|
"Size": "ok &= luaval_to_size(tolua_S, ${arg_idx}, &${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
|
|
|
"Color4B": "ok &=luaval_to_color4b(tolua_S, ${arg_idx}, &${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
|
|
|
"Color4F": "ok &=luaval_to_color4f(tolua_S, ${arg_idx}, &${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
|
|
|
"Color3B": "ok &= luaval_to_color3b(tolua_S, ${arg_idx}, &${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
|
|
|
"PhysicsMaterial": "ok &= luaval_to_physics_material(tolua_S, ${arg_idx}, &${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
|
|
|
"Array*": "ok &= luaval_to_array(tolua_S, ${arg_idx}, &${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
|
|
|
"Dictionary*": "ok &= luaval_to_dictionary(tolua_S, ${arg_idx}, &${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
|
|
|
"AffineTransform": "ok &= luaval_to_affinetransform(tolua_S, ${arg_idx}, &${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
|
|
|
"FontDefinition": "ok &= luaval_to_fontdefinition(tolua_S, ${arg_idx}, &${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
|
|
|
"@Vector<.*>": "ok &= luaval_to_ccvector(tolua_S, ${arg_idx}, &${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
2021-12-31 11:00:35 +08:00
|
|
|
"@Map<std::string.*>": "ok &= luaval_to_ccmap_string_key(tolua_S, ${arg_idx}, &${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
|
|
|
"@map<std::string.*,\\s*std::string.*>": "ok &= luaval_to_std_map_string_string(tolua_S, ${arg_idx}, &${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
2020-10-08 22:32:07 +08:00
|
|
|
"Value": "ok &= luaval_to_ccvalue(tolua_S, ${arg_idx}, &${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
|
|
|
"ValueMap": "ok &= luaval_to_ccvaluemap(tolua_S, ${arg_idx}, &${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
|
|
|
"ValueMapIntKey": "ok &= luaval_to_ccvaluemapintkey(tolua_S, ${arg_idx}, &${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
|
|
|
"ValueVector": "ok &= luaval_to_ccvaluevector(tolua_S, ${arg_idx}, &${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
2021-12-31 11:00:35 +08:00
|
|
|
"@vector<std::string.*>": "ok &= luaval_to_std_vector_string(tolua_S, ${arg_idx}, &${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
2020-10-08 22:32:07 +08:00
|
|
|
"@vector<int.*>": "ok &= luaval_to_std_vector_int(tolua_S, ${arg_idx}, &${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
|
|
|
"kmMat4": "ok &= luaval_to_kmMat4(tolua_S, ${arg_idx}, &${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
|
|
|
"Mat4": "ok &= luaval_to_mat4(tolua_S, ${arg_idx}, &${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
|
|
|
"BlendFunc": "ok &= luaval_to_blendfunc(tolua_S, ${arg_idx}, &${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
|
|
|
"_ttfConfig": "ok &= luaval_to_ttfconfig(tolua_S, ${arg_idx}, &${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
|
|
|
"MeshVertexAttrib": "ok &= luaval_to_mesh_vertex_attrib(tolua_S, ${arg_idx}, &${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
|
|
|
"@vector<float.*>": "ok &= luaval_to_std_vector_float(tolua_S, ${arg_idx}, &${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
|
|
|
"@vector<unsigned short.*>": "ok &= luaval_to_std_vector_ushort(tolua_S, ${arg_idx}, &${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
|
|
|
"AnimationInfo": "ok &= luaval_to_animationInfo(tolua_S, ${arg_idx}, &${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
|
|
|
"TexParams": "ok &= luaval_to_texparams(tolua_S, ${arg_idx}, &${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
|
|
|
"NavMeshAgentParam": "ok &= luaval_to_navmeshagentparam(tolua_S, ${arg_idx}, &${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
|
|
|
"OffMeshLinkData": "ok &= luaval_to_offmeshlinkdata(tolua_S, ${arg_idx}, &${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
|
|
|
"ListenerID": "ok &= luaval_to_std_string(tolua_S, ${arg_idx},&${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
|
|
|
"VertexLayout": "ok &= luaval_to_vertexLayout(tolua_S, ${arg_idx}, ${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
|
|
|
"SamplerDescriptor": "ok &= luaval_to_samplerDescriptor(tolua_S, ${arg_idx}, ${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
|
|
|
"UniformLocation": "ok &= luaval_to_uniformLocation(tolua_S, ${arg_idx}, ${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
|
|
|
|
|
|
|
object: "ok &= luaval_to_object<${arg.to_string($generator).replace(\"*\", \"\")}>(tolua_S, ${arg_idx}, \"${scriptname}\",&${out_value}, \"${lua_namespaced_class_name}:${func_name}\")"
|
|
|
|
from_native:
|
|
|
|
# native to lua
|
|
|
|
int: "tolua_pushnumber(tolua_S,(lua_Number)${in_value})"
|
|
|
|
"unsigned int": "tolua_pushnumber(tolua_S,(lua_Number)${in_value})"
|
|
|
|
"unsigned short": "tolua_pushnumber(tolua_S,(lua_Number)${in_value})"
|
|
|
|
"unsigned char": "tolua_pushnumber(tolua_S,(lua_Number)${in_value})"
|
|
|
|
short: "tolua_pushnumber(tolua_S,(lua_Number)${in_value})"
|
|
|
|
char: "tolua_pushnumber(tolua_S,(lua_Number)${in_value})"
|
|
|
|
"long long": "tolua_pushnumber(tolua_S,(lua_Number)${in_value})"
|
|
|
|
"string": "lua_pushlstring(tolua_S,${in_value}.c_str(),${in_value}.length())"
|
2021-04-22 22:01:47 +08:00
|
|
|
"string_view": "lua_pushlstring(tolua_S,${in_value}.data(),${in_value}.length())"
|
2020-10-08 22:32:07 +08:00
|
|
|
"char*": "tolua_pushstring(tolua_S,(const char*)${in_value})"
|
|
|
|
"String*": "tolua_pushstring(tolua_S, ${in_value}->getCString())"
|
|
|
|
bool: "tolua_pushboolean(tolua_S,(bool)${in_value})"
|
|
|
|
float: "tolua_pushnumber(tolua_S,(lua_Number)${in_value})"
|
|
|
|
double: "tolua_pushnumber(tolua_S,(lua_Number)${in_value})"
|
|
|
|
long: "tolua_pushnumber(tolua_S,(lua_Number)${in_value})"
|
|
|
|
ssize_t: "tolua_pushnumber(tolua_S,(lua_Number)${in_value})"
|
|
|
|
"unsigned long": "tolua_pushnumber(tolua_S,(lua_Number)${in_value})"
|
|
|
|
"Point": "point_to_luaval(tolua_S, ${in_value})"
|
|
|
|
"Vec2": "vec2_to_luaval(tolua_S, ${in_value})"
|
|
|
|
"Vec3": "vec3_to_luaval(tolua_S, ${in_value})"
|
|
|
|
"Vec4": "vec4_to_luaval(tolua_S, ${in_value})"
|
|
|
|
"Rect": "rect_to_luaval(tolua_S, ${in_value})"
|
|
|
|
"Size": "size_to_luaval(tolua_S, ${in_value})"
|
|
|
|
"Color4B": "color4b_to_luaval(tolua_S, ${in_value})"
|
|
|
|
"Color4F": "color4f_to_luaval(tolua_S, ${in_value})"
|
|
|
|
"Color3B": "color3b_to_luaval(tolua_S, ${in_value})"
|
|
|
|
"PhysicsMaterial": "physics_material_to_luaval(tolua_S, ${in_value})"
|
|
|
|
"PhysicsContactData*": "physics_contactdata_to_luaval(tolua_S, ${in_value})"
|
|
|
|
"PhysicsRayCastInfo": "physics_raycastinfo_to_luaval(tolua_S, ${in_value})"
|
|
|
|
"Array*": "array_to_luaval(tolua_S,${in_value})"
|
|
|
|
"Dictionary*": "dictionary_to_luaval(tolua_S, ${in_value})"
|
|
|
|
"AffineTransform": "affinetransform_to_luaval(tolua_S, ${in_value})"
|
|
|
|
"FontDefinition": "fontdefinition_to_luaval(tolua_S, ${in_value})"
|
|
|
|
"@Vector<.*>": "ccvector_to_luaval(tolua_S, ${in_value})"
|
|
|
|
"@Map<std::string.*>": "ccmap_string_key_to_luaval(tolua_S, ${in_value})"
|
2021-12-31 11:00:35 +08:00
|
|
|
"@map<std::string.*,\\s*std::string.*>": "${out_value} = std_map_string_string_to_luaval(tolua_S, ${in_value})"
|
2020-10-08 22:32:07 +08:00
|
|
|
"Value": "ccvalue_to_luaval(tolua_S, ${in_value})"
|
|
|
|
"ValueMap": "ccvaluemap_to_luaval(tolua_S, ${in_value})"
|
|
|
|
"ValueMapIntKey": "ccvaluemapintkey_to_luaval(tolua_S, ${in_value})"
|
|
|
|
"ValueVector": "ccvaluevector_to_luaval(tolua_S, ${in_value})"
|
2021-12-31 11:00:35 +08:00
|
|
|
"@vector<std::string.*>": "ccvector_std_string_to_luaval(tolua_S, ${in_value})"
|
2020-10-08 22:32:07 +08:00
|
|
|
"@vector<int.*>": "ccvector_int_to_luaval(tolua_S, ${in_value})"
|
|
|
|
"Mat4": "mat4_to_luaval(tolua_S, ${in_value})"
|
|
|
|
"BlendFunc": "blendfunc_to_luaval(tolua_S, ${in_value})"
|
|
|
|
"_ttfConfig": "ttfconfig_to_luaval(tolua_S, ${in_value})"
|
|
|
|
"MeshVertexAttrib": "mesh_vertex_attrib_to_luaval(tolua_S, ${in_value})"
|
|
|
|
"@vector<float.*>": "ccvector_float_to_luaval(tolua_S, ${in_value})"
|
|
|
|
"@vector<unsigned short.*>": "ccvector_ushort_to_luaval(tolua_S, ${in_value})"
|
|
|
|
"AnimationInfo": "animationInfo_to_luaval(tolua_S, ${in_value})"
|
|
|
|
"TexParams": "texParams_to_luaval(tolua_S, ${in_value})"
|
|
|
|
"NavMeshAgentParam": "navmeshagentparam_to_luaval(tolua_S, ${in_value})"
|
|
|
|
"OffMeshLinkData": "offmeshlinkdata_to_luaval(tolua_S, ${in_value})"
|
|
|
|
"UniformLocation": "uniformLocation_to_luaval(tolua_S, ${in_value})"
|
|
|
|
"@.*map<std::string.*,\\s*.*AttributeBindInfo>": "program_activeattrs_to_luaval(tolua_S, ${in_value})"
|
|
|
|
|
|
|
|
object: "object_to_luaval<${ntype.replace(\"*\", \"\").replace(\"const \", \"\")}>(tolua_S, \"${scriptname}\",(${ntype.replace(\"const \", \"\")})${in_value})"
|
|
|
|
|