Last active
August 1, 2016 21:09
-
-
Save becm/370e415a3060c9124f63a04ed852a203 to your computer and use it in GitHub Desktop.
special purpose lua interpreter example
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 <lualib.h> | |
#include <lauxlib.h> | |
#include <lua-bitop.h> | |
int interp_run(void) | |
{ | |
int ret; | |
lua_State *L = luaL_newstate(); | |
luaL_openlibs(L); | |
luaL_requiref(L, "bit", luaopen_bit, 1); | |
ret = luaL_dostring(L, "print(bit.bswap(4))"); | |
lua_close(L); | |
return ret; | |
} |
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
project('interp', 'c', default_options : [ | |
'c_std=c11' | |
]) | |
lua = '5.2' | |
bit = meson.get_compiler('c').find_library('lua' + lua + '-bitop') | |
interp = shared_library('interp', 'interp.c', | |
include_directories : include_directories('/usr/include/lua' + lua), | |
dependencies : bit, | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment