This file contains hidden or 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.hpp> | |
#include <lauxlib.h> | |
int main() | |
{ | |
lua_State *L = lua_open(); | |
luaL_openlibs(L); //open standard library | |
lua_close(L); |
This file contains hidden or 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
//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"); |