Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lunar_cheese

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lunar_cheese

  • 0.2.3
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Lunar Cheese

Introduction

This gem allows you to convert between Ruby objects, and Lua table dumps as they are used by the game Don't Starve.

It consists of:

  • A Treetop-based PEG grammar, to parse the Lua table dump into a Ruby object.
  • Additions to Ruby core classes, to dump those objects back into the same format.

If you find any issues, create a ticket on the issue tracker.

Usage

Example usage, Ruby 1.9 & 2.0

#!/usr/bin/env ruby
# coding: utf-8

require 'zlib'
require 'base64'
require 'lunar_cheese'

raw = IO::read('survival_1')
# Base64-decoding, discarding the first eleven bytes
decoded = Base64::decode64(raw[11..-1])
# Inflating, discarding the first 16 bytes
inflated = Zlib::inflate(decoded[16..-1])
# Discarding the 'return' string at the beginning
input = inflated[7..-1]

parser = LunarCheese::LuaTableDumpParser.new
ast = parser.parse(input)
result = ast.to_rb
puts result.inspect

Compatability

This gem has been tested to work on Ruby 2.0.0-p0, 2.0.0-p247, Ruby 1.9.3-p448 and JRuby 1.7.4.

Note that performance on JRuby is worse by quite a bit. Probably related to Treetop's constant usage of extend()

Contributing

  • Fork
  • Feature branch
  • Pull request / git-format-patch

FAQs

Package last updated on 29 Jul 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc