Added lua scripts and fixed a typo in state machine code

This commit is contained in:
Nick Cano
2016-06-06 22:36:51 -07:00
parent 50152ef2c9
commit aceb397307
6 changed files with 131 additions and 1 deletions
+23
View File
@@ -0,0 +1,23 @@
function _verifyLinkedList(address)
local nextItem = readInteger(address) or 0
local previousItem = readInteger(address + 4) or 0
local nextItemBack = readInteger(nextItem + 4)
local previousItemForward = readInteger(previousItem)
return (address == nextItemBack
and address == previousItemForward)
end
function isValueInLinkedList(valueAddress)
for address = valueAddress - 8, valueAddress - 48, -4 do
if (_verifyLinkedList(address)) then
return address
end
end
return 0
end
local node = isValueInLinkedList(addressOfSomeValue)
if (node > 0) then
print(string.format("Value in LL, top of node at 0x0%x", node))
end