@@ -9,11 +9,11 @@ if you want to embed lua in single compilation, create a **test.c** file:
99#define LUA_SINGLE_UNITY_EMBED_MODE
1010#define LUA_SINGLE_UNITY_GUESS_OS
1111#include " lua_single_unity_classic_onelua.c"
12-
1312int main () {
1413
1514 lua_State *L = luaL_newstate();
16- const char *expr = "return 1 + 2 * 3";
15+ luaL_openlibs (L);
16+ const char * expr = "return os.execute('echo carefull these could be executed by your user ')";
1717 if (luaL_dostring(L, expr) == LUA_OK) {
1818 if (lua_isnumber(L, -1)) {
1919 double result = lua_tonumber(L, -1);
@@ -25,6 +25,7 @@ int main() {
2525 lua_close(L);
2626 return 0;
2727}
28+
2829```
2930
3031## Embeding lua in Multi Compilation
@@ -56,9 +57,16 @@ and compile with:
5657cc test.c lua_single_unity_classic_onelua.o -lm
5758```
5859
60+ ## Loading Native libs
61+ native libs are contained into the amalgamation, so you can just call the ** luaL_openlibs(L);**
62+ function to load the native libs.
63+ Note that, these its a dangerous function, since if you are inside a a low code, it can allow
64+ users to run any code, so be careful with this function.
65+ ```
66+
5967
60- # Compiling the runtime
6168
69+ ## Compiling the runtime
6270if you want to compile the **lua_runtime**, you can compile with:
6371
6472```bash
@@ -84,7 +92,7 @@ and running the bytecode in the lua virtual machine with
8492
8593
8694
87- # Build From Scracth
95+ ## Build From Scracth
8896
8997if you want to build from scratch, you will need to have the follwoing tools
9098installed
0 commit comments