From 92f9b7363e92a753c551fdd099d46eab9eddafb0 Mon Sep 17 00:00:00 2001 From: Pelanyo Kamara Date: Sat, 6 Nov 2021 22:14:45 +0000 Subject: [PATCH] create simple interface --- CLI/Repl.cpp | 14 +- CLI/html/index.html | 1045 ++----------------------------------------- CMakeLists.txt | 2 +- 3 files changed, 58 insertions(+), 1003 deletions(-) diff --git a/CLI/Repl.cpp b/CLI/Repl.cpp index 2fb7b135..68db2864 100644 --- a/CLI/Repl.cpp +++ b/CLI/Repl.cpp @@ -252,7 +252,16 @@ static void completeRepl(lua_State* L, const char* editBuffer, std::vector(ptr)->what(); + } + + void executeScript(const char* source) { std::unique_ptr globalState(luaL_newstate(), lua_close); lua_State* L = globalState.get(); @@ -271,8 +280,6 @@ extern "C" { fprintf(stdout, "%s\n", error.c_str()); } - - return error.c_str(); } } #endif @@ -457,7 +464,6 @@ int main(int argc, char** argv) if (strncmp(flag->name, "Luau", 4) == 0) flag->value = true; - executeCode("print'asd'"); if (argc == 1) { runRepl(); diff --git a/CLI/html/index.html b/CLI/html/index.html index bf982507..e3cf8cc7 100644 --- a/CLI/html/index.html +++ b/CLI/html/index.html @@ -1,1011 +1,60 @@ - - Emscripten-Generated Code - + Luau Web REPL - - image/svg+xml - - -
-
Downloading...
- - - Resize canvas - Lock/hide mouse pointer     - - - - - -
- +
+ +
+ +

+ + +
+

+
+ +
+ +

+
- -
- -
- - - - - + \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index d8240c00..03464dae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,7 +38,7 @@ if(LUAU_BUILD_WEB_REPL AND EMSCRIPTEN) endif() # declare exported functions to emscripten - target_link_options(Luau.Repl.Web PRIVATE -sEXPORTED_FUNCTIONS=['_executeOnce'] -sEXPORTED_RUNTIME_METHODS=['ccall','cwrap']) + target_link_options(Luau.Repl.Web PRIVATE -sEXPORTED_FUNCTIONS=['_getExceptionFromPtr','_executeScript'] -sEXPORTED_RUNTIME_METHODS=['ccall','cwrap'] -sNO_DISABLE_EXCEPTION_CATCHING) # copy html directory add_custom_command(TARGET Luau.Repl.Web PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/CLI/html ${CMAKE_BINARY_DIR}/webrepl)