This repository has been archived on 2022-10-27. You can view files and clone it, but cannot push or open issues or pull requests.
InfinitShoot/binding/lua/executor.c

20 lines
383 B
C
Raw Normal View History

2022-07-29 21:35:46 +08:00
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
int main() {
lua_State* L = luaL_newstate();
if (!L) {
printf("lua init failed\n");
return 1;
}
2022-07-30 01:39:39 +08:00
luaL_openlibs(L);
2022-07-29 21:35:46 +08:00
if (luaL_loadfile(L, "main.lua") || lua_pcall(L, 0, 0, 0)) {
printf("main.lua load and execute failed\n");
return 1;
}
lua_close(L);
return 0;
}