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)
Tag Archives: function
see.lua – Introspecting Lua objects
As via its python equivalent, see.lua takes in an object and prints out a list of its elements as well as metatable methods in readable text.
> require "see" > s = see(string) .byte(?) .char(?) .dump(?) .find(?)
…
Posted in Blog, Lua, Programming, Snippets
Tagged function, introspect, Lua, object, parameters, see, table
1 Comment
Lua – Get number of parameters in a function
The following snippet defines a function num_args(func) that returns the number of parameters within a function as a string:
num_args(function(a,b,c) end) --> 3
It also works with functions that have variable arguments:
num_args(function(a,...)
…
Posted in Blog, Lua, Programming, Snippets
Tagged arguments, bytecode, dump, function, Lua
Leave a comment
Python – Abstract Function class
Python is great. It’s dynamic, it’s flexible, and best of all, for almost all major datatypes, there’s an associated abstract class from which you can over-ride and build your own object out of.
Of course, Python doesn’t treat functions in…
Posted in Programming, Python, Snippets
Tagged abstract, abstract class, abstract function, class, datatype, equal, function, overload, Programming, py, Python, __call__, __eq__
Leave a comment