Skip to content

Commit

Permalink
#1647 - bitmap set/get added to the Lua interpreter
Browse files Browse the repository at this point in the history
  • Loading branch information
bsongis committed Sep 15, 2014
1 parent 829567a commit 93d2837
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions radio/src/lua.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,7 @@ static int luaModelGetInfo(lua_State *L)
{
lua_newtable(L);
lua_pushtablezstring(L, "name", g_model.header.name);
lua_pushtablenzstring(L, "bitmap", g_model.header.bitmap);
lua_pushtableinteger(L, "id", g_model.header.modelId);
return 1;
}
Expand All @@ -571,6 +572,10 @@ static int luaModelSetInfo(lua_State *L)
str2zchar(g_model.header.name, name, sizeof(g_model.header.name));
memcpy(modelHeaders[g_eeGeneral.currModel].name, g_model.header.name, sizeof(g_model.header.name));
}
else if (!strcmp(key, "bitmap")) {
const char * name = luaL_checkstring(L, -1);
strncpy(g_model.header.bitmap, name, sizeof(g_model.header.bitmap));
}
else if (!strcmp(key, "id")) {
g_model.header.modelId = luaL_checkinteger(L, -1);
modelHeaders[g_eeGeneral.currModel].modelId = g_model.header.modelId;
Expand Down

0 comments on commit 93d2837

Please sign in to comment.