122 |
122 |
123 #include <stringprep.h> |
123 #include <stringprep.h> |
124 |
124 |
125 static int stringprep_prep(lua_State *L, const Stringprep_profile *profile) |
125 static int stringprep_prep(lua_State *L, const Stringprep_profile *profile) |
126 { |
126 { |
|
127 if(!lua_isstring(L, 1)) { |
|
128 lua_pushnil(L); |
|
129 return 1; |
|
130 } |
127 size_t len; |
131 size_t len; |
128 const char *s = luaL_checklstring(L, 1, &len); |
132 const char *s = lua_tolstring(L, 1, &len); |
129 char string[1024]; |
133 char string[1024]; |
130 int ret; |
134 int ret; |
131 if (len >= 1024) { |
135 if (len >= 1024) { |
132 lua_pushnil(L); |
136 lua_pushnil(L); |
133 return 1; // TODO return error message |
137 return 1; // TODO return error message |