aboutsummaryrefslogtreecommitdiff
path: root/src/textadept.c
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2013-04-24 09:32:10 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2013-04-24 09:32:10 -0400
commit3f3c9838290e9d3df43d94ab389646985aa4613d (patch)
treeb4ccaf9258676b0c09e3c8efb8898191673fb4ee /src/textadept.c
parent9e97b8fa01638740f1ab2880a6a72bd1275c6fd6 (diff)
downloadtextadept-3f3c9838290e9d3df43d94ab389646985aa4613d.tar.gz
textadept-3f3c9838290e9d3df43d94ab389646985aa4613d.zip
Renamed `_G.buffer_new()` to `buffer.new()`.
Diffstat (limited to 'src/textadept.c')
-rw-r--r--src/textadept.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/textadept.c b/src/textadept.c
index f13d4e0d..2495a0df 100644
--- a/src/textadept.c
+++ b/src/textadept.c
@@ -1121,6 +1121,13 @@ static int lbuffer_delete(lua_State *L) {
return 0;
}
+/** `_G.buffer_new()` Lua function. */
+static int lbuffer_new(lua_State *L) {
+ new_buffer(0);
+ lua_getfield(L, LUA_REGISTRYINDEX, "ta_buffers");
+ return (lua_rawgeti(L, -1, lua_rawlen(L, -1)), 1);
+}
+
/** `buffer.text_range()` Lua function. */
static int lbuffer_text_range(lua_State *L) {
lL_globaldoccheck(L, 1);
@@ -1294,6 +1301,7 @@ static void lL_adddoc(lua_State *L, sptr_t doc) {
lua_pushvalue(L, -1), lua_setfield(L, -3, "doc_pointer");
l_setcfunction(L, -2, "check_global", lbuffer_check_global);
l_setcfunction(L, -2, "delete", lbuffer_delete);
+ l_setcfunction(L, -2, "new", lbuffer_new);
l_setcfunction(L, -2, "text_range", lbuffer_text_range);
l_setmetatable(L, -2, "ta_buffer", lbuf_property, lbuf_property);
// bs[userdata] = b, bs[#bs + 1] = b, bs[b] = #bs
@@ -1325,13 +1333,6 @@ static void new_buffer(sptr_t doc) {
lL_event(lua, "buffer_new", -1);
}
-/** `_G.buffer_new()` Lua function. */
-static int lbuffer_new(lua_State *L) {
- new_buffer(0);
- lua_getfield(L, LUA_REGISTRYINDEX, "ta_buffers");
- return (lua_rawgeti(L, -1, lua_rawlen(L, -1)), 1);
-}
-
/** `_G.quit()` Lua function. */
static int lquit(lua_State *L) {
#if GTK
@@ -1519,7 +1520,6 @@ static int lL_init(lua_State *L, int argc, char **argv, int reinit) {
lua_setglobal(L, "gui");
lua_getglobal(L, "_G");
- l_setcfunction(L, -1, "new_buffer", lbuffer_new);
l_setcfunction(L, -1, "quit", lquit);
l_setcfunction(L, -1, "reset", lreset);
l_setcfunction(L, -1, "timeout", ltimeout);