guint str_vec_len = 0; int i;
const char * sep;
const char * str = lua_tolstring(L, 1, NULL);
+
+ if ( NULL == str || '\0' == str[0]){
+ lua_newtable(L);
+ return 1;
+ }
sep = lua_tolstring(L, 2, NULL);
- str_vec = g_strsplit(str, sep, 0);
+ if ( NULL == sep || '\0' == sep[0]){
+ lua_newtable(L);
+ return 1;
+ }
+ str_vec = g_strsplit(str, sep, 0);
str_vec_len = g_strv_length(str_vec);
+
lua_createtable(L, str_vec_len, 0);
for ( i = 0; i < str_vec_len; ++i){
lua_pushinteger(L, i + 1);
tab = ime.split_string(nil, nil);
for i,v in ipairs(tab) do print(i, v) end
+tab = ime.split_string("aa..bb..cc", nil);
+for i,v in ipairs(tab) do print(i, v) end
+
tab = ime.split_string("aa..bb..cc", "..");
print(ime.join_string(tab, ", "));