Categories
- Blog (104)
- Lua (13)
- Miscellaneous (48)
- Photos (6)
- Programming (33)
- Python (15)
- Sample (3)
- Web Design (3)
- Writing (2)
- Portfolio (40)
- Snippets (28)
- Blog (104)
Monthly Archives: April 2010
Lua Exception Handling
Wouldn’t it be awsome if you could do something like
dofile "try"
try{
function()
a = a/a
end
}.except(Exceptions.ValueError){
function(_, exceptions, detail)
print(detail)
end
}
And get
lua:5: attempt to perform arithmetic on
…
Posted in Blog, Lua, Programming, Snippets
Tagged error handling, except, exceptions, Lua, try
2 Comments
Linked Lists via ctypes in Python
from ctypes import *
class linknode(Structure):
pass
linknode._fields_ = [
("nextNode", POINTER(linknode)),
("intData", c_int),
]
class linked_list():
head_node = None
def add(self, int_data):
node_to_add = linknode(intData = c_int(int_data))
if (self.head_node == None):
self.head_node = node_to_add
else:
traverse_node
…
Posted in Programming, Python, Snippets
Tagged ctypes, linked list, pointers, Python, structure
Leave a comment