Skip to content

Instantly share code, notes, and snippets.

@stonetoad
stonetoad / dump.lua
Created October 28, 2014 01:21
lua dump function from MrMagical on ##starbound-modding
-- Dumps value as a string closely resemling Lua code that could be used to
-- recreate it (with the exception of functions, threads and recursive tables).
--
-- Basic usage: dump(value)
--
-- @param value The value to be dumped.
-- @param indent (optional) String used for indenting the dumped value.
-- @param seen (optional) Table of already processed tables which will be
-- dumped as "{...}" to prevent infinite recursion.
function dump(value, indent, seen)
local my_entity=df.historical_entity.find(df.global.ui.civ_id)
local sText=" "
local k=0
local v=1
for x,y in pairs(df.global.world.entities.all) do
my_entity=y
k=0
while k < #my_entity.resources.misc_mat.extracts.mat_index do
v=my_entity.resources.misc_mat.extracts.mat_type[k]
@stonetoad
stonetoad / embark_profiles.txt
Created April 22, 2014 00:32
My current embark profile, almost never survives embarking!
[PROFILE]
[TITLE:Early metal fast start]
[SKILL:1:COOK:5]
[SKILL:1:PLANT:4]
[SKILL:1:FORGE_ARMOR:1]
[SKILL:2:BREWING:1]
[SKILL:2:PLANT:4]
[SKILL:2:BOWYER:5]
@stonetoad
stonetoad / emptybin.lua
Created April 21, 2014 00:33
Some helper scripts for dfhack
-- Empty a bin onto the floor
print('Finding selected item...')
a = dfhack.gui.getSelectedItem()
print('Found ', dfhack.items.getDescription(a,0))
if not a then dfhack.printerr("No item selected!")
end
loc = a.pos
@stonetoad
stonetoad / test-client.hs
Created April 7, 2014 01:32
Playing around with Data.Conduit.Network
{-# LANGUAGE FlexibleContexts, OverloadedStrings, NoMonomorphismRestriction #-}
import Data.Conduit as C
import Data.Conduit.Network as CN
import Data.Maybe
import Data.Monoid
import System.IO (stdout)
import qualified Data.Conduit.List as CL
import qualified Data.Conduit.Binary as CB
import Data.ByteString.Char8 (ByteString, pack)
import qualified Data.ByteString as S