Last active
March 31, 2025 18:42
-
-
Save jaredkrinke/9347caa418f9b72fe04c80d4897431af to your computer and use it in GitHub Desktop.
Minimal Lua5.1 test app for POSIX (compiled size on x64 Debian is ~130 KB with static Lua, dynamic libc/libm)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <lua.h> | |
| #include <lauxlib.h> | |
| int main() | |
| { | |
| lua_State* L = luaL_newstate(); | |
| char* line = NULL; | |
| size_t n = 0; | |
| for (;;) { | |
| if (getline(&line, &n, stdin) <= 1) { | |
| break; | |
| } | |
| luaL_dostring(L, line); | |
| printf("> %s\n", lua_tostring(L, -1)); | |
| } | |
| free(line); | |
| lua_close(L); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment