Skip to content

Instantly share code, notes, and snippets.

@laheadle
Last active December 10, 2015 12:08
Show Gist options
  • Save laheadle/4431714 to your computer and use it in GitHub Desktop.
Save laheadle/4431714 to your computer and use it in GitHub Desktop.
Winmain Function
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,
LPSTR lpCmdLine,int nCmdShow)
{
lua_State* L = luaL_newstate();
luaL_openlibs(L);
luaL_dostring(L, "require \"ezshare\"");
lua_getfield(L, LUA_GLOBALSINDEX, "run");
lua_pushlightuserdata (L, hInstance);
lua_pushlstring(L, lpCmdLine, strlen(lpCmdLine));
lua_pushinteger(L, nCmdShow);
lua_call(L, 3, 1);
return lua_tointeger(L, -1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment