]> git.saurik.com Git - redis.git/commitdiff
Lua reports line numbers off by one in error messages
authorJakub Wieczorek <fawek@fawek.net>
Sun, 29 Jan 2012 13:53:49 +0000 (14:53 +0100)
committerJakub Wieczorek <fawek@fawek.net>
Sun, 29 Jan 2012 13:53:49 +0000 (14:53 +0100)
src/scripting.c

index 1503c3c90e14d32298fee4f5035397a61595619c..255184e7de71831e7ba36ca43af2ce6e632234a8 100644 (file)
@@ -516,9 +516,9 @@ int luaCreateFunction(redisClient *c, lua_State *lua, char *funcname, robj *body
 
     funcdef = sdscat(funcdef,"function ");
     funcdef = sdscatlen(funcdef,funcname,42);
-    funcdef = sdscatlen(funcdef," ()\n",4);
+    funcdef = sdscatlen(funcdef,"() ",3);
     funcdef = sdscatlen(funcdef,body->ptr,sdslen(body->ptr));
-    funcdef = sdscatlen(funcdef,"\nend\n",5);
+    funcdef = sdscatlen(funcdef," end",4);
 
     if (luaL_loadbuffer(lua,funcdef,sdslen(funcdef),"func definition")) {
         addReplyErrorFormat(c,"Error compiling script (new function): %s\n",