From 47ec2b55c737a9050f94377970e4157c93409e9e Mon Sep 17 00:00:00 2001 From: Krzosa Karol Date: Fri, 9 Aug 2024 09:46:16 +0200 Subject: [PATCH] LuaAppendCmd --- src/text_editor/lua_api.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/text_editor/lua_api.cpp b/src/text_editor/lua_api.cpp index 605b6fe..e1f0978 100644 --- a/src/text_editor/lua_api.cpp +++ b/src/text_editor/lua_api.cpp @@ -91,7 +91,15 @@ void Open(String16 path) { Open(string); } -int LuaExec(lua_State *L) { +int LuaAppendCmd(lua_State *L) { + String string = lua_tostring(L, 1); + lua_pop(L, 1); + String working_dir = GetCurrentBufferDir(); + Exec(ConsoleViewID, true, string, working_dir); + return 0; +} + +int LuaNewCmd(lua_State *L) { String string = lua_tostring(L, 1); lua_pop(L, 1); @@ -203,7 +211,8 @@ luaL_Reg LuaFunctions[] = { { "print", LuaPrint}, { "Print", LuaPrint}, { "Kill", LuaKill}, - { "c", LuaExec}, + { "NewC", LuaNewCmd}, + { "AppendC", LuaAppendCmd}, { NULL, NULL}, };