lua函数返回多个值
来源:互联网 发布:怎么知道我的网络 编辑:程序博客网 时间:2024/05/21 06:33
function CompareString(in_source, in_compare)local ret_value;local ret_msg;if (in_source > in_compare) thenvalue =1;msg = 'source greate then';endif (in_source < in_compare) then value =-1; msg = 'source less then';endif (in_source == in_compare) thenvalue =0;msg = 'source equal then';endreturn value,msg;endsource_string = "reacher";in_string = io.read();--获取字符串对比函数输入execute_status, ret_msg = CompareString(source_string, in_string);print('get execute status:'..execute_status);print(ret_msg);