Created
November 26, 2012 22:34
-
-
Save ecerulm/4151111 to your computer and use it in GitHub Desktop.
sample lua application
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
| all: test | |
| test: test.cpp | |
| g++ test.cpp -llua -L$(HOME)/tmp/lua-5.2.1/src -I$(HOME)/tmp/lua-5.2.1/src -o test |
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 <iostream> | |
| #include <lua.hpp> | |
| #include <assert.h> | |
| #include <queue> | |
| using namespace std; | |
| int main() | |
| { | |
| cout << "test" << endl; | |
| std::queue<int> queue; | |
| for(unsigned int i=0; i < 10; i++) { | |
| queue.push(i*100); | |
| } | |
| lua_State *L; | |
| L = luaL_newstate(); | |
| luaL_openlibs(L); | |
| int error = luaL_dofile(L, "./test.lua"); | |
| if (error) { | |
| fprintf(stderr, "%s\n", lua_tostring(L,-1)); | |
| lua_pop(L,1); | |
| exit(1); | |
| } | |
| 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
| print("hello world") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment