I hereby claim:
- I am britzl on github.
- I am britzl (https://keybase.io/britzl) on keybase.
- I have a public key whose fingerprint is 0550 F9F9 695B AA0E C6A3 E29E 081A 6067 688C FEA3
To claim this, I am signing this object:
local function a() | |
print(debug.traceback()) | |
end | |
local function b() | |
a() | |
end | |
local function c() | |
b() |
local function on_error(err) | |
print("In custom error handler:", err) | |
-- something went wrong, handle error here | |
-- report to client health for instance | |
-- print(debug.traceback()) | |
-- dump tables | |
end | |
local function do_something(a_number) | |
-- if this check fails it will be caught by the error handler |
-- keep the original print() | |
local _print = print | |
local indentation = "" | |
--- Pretty print a value | |
-- If the value is a table it's content will be printed as well (recursively) | |
local function pretty_print(value) | |
local t = type(value) | |
if t ~= "table" then |
I hereby claim:
To claim this, I am signing this object:
--- A module for guarding tables from new indices. Typical use is to guard the global scope. | |
-- Get the latest version from https://gist.github.com/britzl/546d2a7e32a3d75bab45 | |
-- @module superstrict | |
-- @usage | |
-- | |
-- -- Defold specific example. Allow the gameobject and gui script lifecycle functions. Also allow assignment of | |
-- -- facebook and iap modules for dummy implementations on desktop. The whitelist handles pattern matching and in the | |
-- -- example all functions prefixed with '__' will also be allowed in the global scope | |
-- local superstrict = require("superstrict") | |
-- superstrict.lock(_G, { "go", "gui", "msg", "url", "sys", "render", "factory", "particlefx", "physics", "sound", "sprite", "image", "tilemap", "vmath", "matrix4", "vector3", "vector4", "quat", "hash", "hash_to_hex", "hashmd5", "pprint", "iap", "facebook", "push", "http", "json", "spine", "zlib", "init", "final", "update", "on_input", "on_message", "on_reload", "__*" }) |
local function gdump() | |
local function dump_table(t, indentation) | |
indentation = indentation or "" | |
local table_model = {} | |
for k,v in pairs(t) do | |
table_model[type(v)] = table_model[type(v)] or {} | |
table_model[type(v)][k] = v | |
end | |
for type,_ in pairs(table_model) do | |
print(indentation .. type .. ":") |
# from http://stackoverflow.com/a/8597411/1266551 | |
if [[ "$OSTYPE" == "linux-gnu" ]]; then | |
# ... | |
elif [[ "$OSTYPE" == "darwin"* ]]; then | |
# Mac OSX | |
elif [[ "$OSTYPE" == "cygwin" ]]; then | |
# POSIX compatibility layer and Linux environment emulation for Windows | |
elif [[ "$OSTYPE" == "msys" ]]; then | |
# Lightweight shell and GNU utilities compiled for Windows (part of MinGW) | |
elif [[ "$OSTYPE" == "win32" ]]; then |
#!/bin/bash | |
# Downloads an OS specific Lua 5.1 binary | |
if [[ "$OSTYPE" == "linux-gnu" ]]; then | |
LUA_DOWNLOAD_URL="http://sourceforge.net/projects/luabinaries/files/5.1.5/Tools%20Executables/lua-5.1.5_Linux32_64_bin.tar.gz/download" | |
LUA_BINARY=lua5.1 | |
elif [[ "$OSTYPE" == "darwin"* ]]; then | |
LUA_DOWNLOAD_URL="http://sourceforge.net/projects/luabinaries/files/5.1.5/Tools%20Executables/lua-5.1.5_MacOS109_bin.tar.gz/download" | |
LUA_BINARY=lua5.1 | |
elif [[ "$OSTYPE" == "win32" ]]; then |
--- Module that can be used to get a callback when a certain amount of time has elapsed | |
-- | |
-- @usage | |
-- local timer = require "timer" | |
-- function init(self) | |
-- self.t1 = timer.seconds(2, function() | |
-- print("2 seconds have elapsed") | |
-- end) | |
-- self.t2 = timer.seconds(5, function() | |
-- print("5 seconds have elapsed") |
#!/bin/bash | |
title=$(less game.project | grep "^title = " | cut -d "=" -f2 | sed -e 's/^[[:space:]]*//') | |
title_no_space=$(echo -e "${title}" | tr -d '[[:space:]]') | |
echo "Project: ${title}" | |
if [ ! -f bob.jar ] | |
then | |
echo "Unable to find bob.jar. Download it from d.defold.com." | |
exit 1 |