static int pushline(Lua.LuaState L, int firstline) { Lua.CharPtr buffer = new char[Lua.LUA_MAXINPUT]; Lua.CharPtr b = new Lua.CharPtr(buffer); int l; Lua.CharPtr prmt = get_prompt(L, firstline); if (!Lua.lua_readline(L, b, prmt)) { return(0); /* no input */ } l = Lua.strlen(b); if (l > 0 && b[l - 1] == '\n') /* line ends with newline? */ { b[l - 1] = '\0'; /* remove it */ } if ((firstline != 0) && (b[0] == '=')) /* first line starts with `=' ? */ { Lua.lua_pushfstring(L, "return %s", b + 1); /* change it to `return' */ } else { Lua.lua_pushstring(L, b); } Lua.lua_freeline(L, b); return(1); }