parent
3cdfd9866e
commit
680518d13c
|
@ -78,7 +78,9 @@ static void handleCanFrame(LuaHandle& ls, CANRxFrame* frame) {
|
|||
lua_newtable(ls);
|
||||
for (size_t i = 0; i < dlc; i++) {
|
||||
lua_pushinteger(ls, frame->data8[i]);
|
||||
lua_rawseti(ls, -2, i);
|
||||
|
||||
// index is i+1 because Lua "arrays" (tables) are 1-indexed
|
||||
lua_rawseti(ls, -2, i + 1);
|
||||
}
|
||||
|
||||
// Perform the actual function call
|
||||
|
|
|
@ -125,7 +125,7 @@ static int lua_txCan(lua_State* l) {
|
|||
while (true) {
|
||||
lua_pushnumber(l, dlc + 1);
|
||||
auto elementType = lua_gettable(l, 4);
|
||||
auto val = lua_tointeger(l, -1);
|
||||
auto val = lua_tonumber(l, -1);
|
||||
lua_pop(l, 1);
|
||||
|
||||
if (elementType == LUA_TNIL) {
|
||||
|
|
Loading…
Reference in New Issue