Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions load81.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,15 +213,14 @@ int backgroundBinding(lua_State *L) {
}

int getpixelBinding(lua_State *L) {
Uint32 pixel;
int x, y;
unsigned char rgb[3];

x = lua_tonumber(L,-2);
y = l81.fb->height - 1 - lua_tonumber(L,-1);

if (x < 0 || x >= l81.fb->width || y < 0 || y >= l81.fb->height) {
pixel = 0;
rgb[0] = rgb[1] = rgb[2] = 0;
} else {
SDL_Rect rect = {x,y,1,1};
SDL_RenderReadPixels(l81.fb->renderer,&rect,SDL_PIXELFORMAT_BGR888,
Expand Down
3 changes: 1 addition & 2 deletions lua/src/lauxlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ LUALIB_API int luaL_loadfile (lua_State *L, const char *filename) {
lf.f = freopen(filename, "rb", lf.f); /* reopen in binary mode */
if (lf.f == NULL) return errfile(L, "reopen", fnameindex);
/* skip eventual `#!...' */
while ((c = getc(lf.f)) != EOF && c != LUA_SIGNATURE[0]) ;
while ((c = getc(lf.f)) != EOF && c != LUA_SIGNATURE[0]) ;
lf.extraline = 0;
}
ungetc(c, lf.f);
Expand Down Expand Up @@ -649,4 +649,3 @@ LUALIB_API lua_State *luaL_newstate (void) {
if (L) lua_atpanic(L, &panic);
return L;
}

7 changes: 3 additions & 4 deletions lua/src/ltablib.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ static int tremove (lua_State *L) {
static void addfield (lua_State *L, luaL_Buffer *b, int i) {
lua_rawgeti(L, 1, i);
if (!lua_isstring(L, -1))
luaL_error(L, "invalid value (%s) at index %d in table for "
LUA_QL("concat"), luaL_typename(L, -1), i);
luaL_addvalue(b);
return luaL_error(L, "invalid value (%s) at index %d in table for "
LUA_QL("concat"), luaL_typename(L, -1), i);
luaL_addvalue(b);
}


Expand Down Expand Up @@ -284,4 +284,3 @@ LUALIB_API int luaopen_table (lua_State *L) {
luaL_register(L, LUA_TABLIBNAME, tab_funcs);
return 1;
}