単純なeval

#include <stdio.h>

#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"

int main() {
  lua_State *L;
  lua_Debug *ar;

  L = lua_open();
  luaopen_base(L);
  luaL_loadstring(L, "a = 100 \n print(a)");

  if(lua_pcall(L, 0, 0, 0) != 0) {
    printf("error: %s\n", lua_tostring(L, -1));
  }

  lua_pop(L, 1);
  lua_close(L);
}