- UsbCommand *c = (UsbCommand *)lua_touserdata(L, 1);
- luaL_argcheck(L, c != NULL, 1, "'UsbCommand' expected");
- SendCommand(c);
+ size_t size;
+ const char *data = luaL_checklstring(L, 1, &size);
+ if(size != sizeof(UsbCommand))
+ {
+ printf("Got data size %d, expected %d" , size,sizeof(UsbCommand));
+ lua_pushstring(L,"Wrong data size");
+ return 1;
+ }
+
+// UsbCommand c = (*data);
+ SendCommand(data);