libglacier/lua/lua.c

38 lines
835 B
C
Raw Normal View History

2024-07-21 22:35:38 -04:00
#include <color.h>
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include <wchar.h>
const wchar_t check = 0x2713;
int
main(int argc, char **argv)
{
printf(COL_BLUE "[i] " COL_RESET "Initializing Lua state...\n");
lua_State *L = luaL_newstate();
luaL_openlibs(L);
printf(COL_BLUE "[i] " COL_RESET "Loading test package...\n");
if (luaL_loadfile(L, "testpkg.lua")) {
fprintf(stderr, COL_RED "[x] " COL_RESET "Failed to load test package file.\n");
lua_close(L);
exit(1);
}
printf(COL_BLUE "[i] " COL_RESET "Executing test package...\n");
if (lua_pcall(L, 0, 0, 0)) {
fprintf(stderr, COL_RED "[x] " COL_RESET "Failed to execute test package file.\n");
lua_close(L);
exit(1);
}
lua_close(L);
printf("Closed lua libraries\n");
return 0;
}