Skip to content

Instantly share code, notes, and snippets.

View yosuke-tamura's full-sized avatar
Working on

Yosuke Tamura yosuke-tamura

Working on
View GitHub Profile
#include <lua.hpp>
#include <lauxlib.h>
int main()
{
lua_State *L = lua_open();
luaL_openlibs(L); //open standard library
lua_close(L);
@yosuke-tamura
yosuke-tamura / arg2lua
Last active August 29, 2015 13:58
C++ main関数のコマンドライン引数をLuaに渡すコード
//L: lua_State pointer
lua_newtable(L);
for(int i=0; i<argc; i++)
{
lua_pushinteger(L, i+1);
lua_pushstring(L, argv[i]);
lua_settable(L, -3);
}
lua_setglobal(L, "args");