Print and print in lua
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
int Lua_Print(lua_State *L) {
|
||||
int Lua_print(lua_State *L) {
|
||||
Scratch scratch;
|
||||
int nargs = lua_gettop(L);
|
||||
View *null_view = GetView(NullViewID);
|
||||
@@ -11,6 +11,19 @@ int Lua_Print(lua_State *L) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Lua_Print(lua_State *L) {
|
||||
Scratch scratch;
|
||||
int nargs = lua_gettop(L);
|
||||
View *view = GetView(DebugViewID);
|
||||
for (int i = 1; i <= nargs; i += 1) {
|
||||
String string = lua_tostring(L, i);
|
||||
Command_Appendf(view, "%.*s ", FmtString(string));
|
||||
}
|
||||
Command_Appendf(view, "\n");
|
||||
lua_pop(L, nargs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Lua_Kill(lua_State *L) {
|
||||
BSet main = GetActiveMainSet();
|
||||
KillProcess(main.view);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
luaL_Reg LuaFunctions[] = {
|
||||
{"print", Lua_print},
|
||||
{"Print", Lua_Print},
|
||||
{"Kill", Lua_Kill},
|
||||
{"GetLoadWord", Lua_GetLoadWord},
|
||||
|
||||
@@ -21,6 +21,7 @@ WindowID NullWindowID;
|
||||
|
||||
// hidden floating window
|
||||
WindowID DebugWindowID;
|
||||
ViewID DebugViewID;
|
||||
BufferID DebugBufferID;
|
||||
|
||||
WindowSplit WindowSplits;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
FEATURE SaveAll dirty files which are saved on disk already but dirty
|
||||
DESIGN try to make console less special, make stuff reusable etc.
|
||||
DESIGN Config file versions, when loading should be checked, at the top of the file, what to do when old version?
|
||||
ISSUE Ctrl+Alt+Down (DuplicateLine) doesn't work on ubuntu
|
||||
DESIGN Moving vertically between splits, which keys???
|
||||
@@ -53,7 +54,6 @@ backlog
|
||||
- redo tree
|
||||
- gap buffer
|
||||
- optimize rendering - command buffer, and vertice buffer instead of vertice buffer with scissor
|
||||
- fix sdl mouse cursor code, visual artifacts, fast cursor changing stuff
|
||||
|
||||
|
||||
!!As little lua code as possible, but lua code should be powerful just in case of quick edits
|
||||
@@ -197,6 +197,7 @@ void InitWindows() {
|
||||
buffer->no_history = true;
|
||||
|
||||
View *view = CreateView(buffer->id);
|
||||
DebugViewID = view->id;
|
||||
window->active_view = view->id;
|
||||
|
||||
Window *titlebar = CreateTitlebar(window->id);
|
||||
|
||||
Reference in New Issue
Block a user