diff --git a/lua.cpp b/lua.cpp index b0bdbff..3d66bcc 100644 --- a/lua.cpp +++ b/lua.cpp @@ -97,8 +97,8 @@ extern "C" { const int numargs = lua_gettop(L); switch (numargs) { case 0: { - setdest(0); - return 0; + lua_pushinteger(L, getdest()); + return 1; } case 1: { uint8_t surface = luaL_checkinteger(L, 1); @@ -114,8 +114,8 @@ extern "C" { const int numargs = lua_gettop(L); switch (numargs) { case 0: { - setsource(0); - return 0; + lua_pushinteger(L, getsource()); + return 1; } case 1: { uint8_t surface = luaL_checkinteger(L, 1); diff --git a/mini.cpp b/mini.cpp index 88fe463..e73b292 100644 --- a/mini.cpp +++ b/mini.cpp @@ -359,6 +359,18 @@ void setmap(uint8_t surface) { map_surface = &surfaces[surface]; } +uint8_t getdest() +{ + for (unsigned int i=0; i