Created
November 20, 2012 19:45
-
-
Save Bradshaw/4120537 to your computer and use it in GitHub Desktop.
This file contains 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 <lua.h> | |
#include <lauxlib.h> | |
#include <lualib.h> | |
#include <stdio.h> | |
void maFonctionC(){ | |
printf("Cool\n"); | |
} | |
int main(int argc, char** argv, char** env){ | |
lua_State *L = lua_open(); | |
luaL_openlibs(L); | |
luaL_dofile(L, "script.lua"); | |
static const luaL_reg cfunc[]={ | |
{"func", maFonctionC}, | |
{NULL, NULL} | |
}; | |
luaL_register(L, "c", renderfunc); | |
char buff[256]; | |
int error; | |
while (1){ | |
lua_getfield(L, LUA_GLOBALSINDEX, "update"); | |
lua_call(L, 0, 0); | |
} | |
return 0; | |
} |
This file contains 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
function update() | |
c.maFonctionC() | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment