Skip to content

Instantly share code, notes, and snippets.

Created December 5, 2017 04:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/35b76407db03b8296f6cc06c408ec900 to your computer and use it in GitHub Desktop.
Save anonymous/35b76407db03b8296f6cc06c408ec900 to your computer and use it in GitHub Desktop.
Minimal Lua interpreter
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
lua_State *L = luaL_newstate();
luaL_openlibs(L);
if (argc == 2)
luaL_dofile(L, argv[1]);
else
fprintf(stderr, "Usage: %s <script.lua>\n", argv[0]);
lua_close(L);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment