Skip to content

Latest commit

 

History

History
29 lines (26 loc) · 1.03 KB

README.md

File metadata and controls

29 lines (26 loc) · 1.03 KB

GDScriptDictionaryToCrystalHash

Converts a GDScript's Dictionary to a Crystal Hash

What does this do?

  • Converts this:
var dictionary = {
   "1": {"id": 1, "name": "item 1", "modifiers": { muffin = 123}},
   "2": {"id": 1, "name": "item 1", "modifiers": { muffin = 123}},
   "3": {"id": 1, "name": "item 1", "modifiers": { muffin = 123}},
   }
  • Into this:
class NodeTypesClass
	property id = "" 
	property name = "" 
	property modifiers : Hash(String, Int32)
	def initialize(@id,@name,@modifiers) end
end
NodeTypes = Hash(String, NodeTypesClass).new
NodeTypes["1"] = NodeTypesClass.new("1","item 1",{"muffin"=>123})
NodeTypes["2"] = NodeTypesClass.new("1","item 1",{"muffin"=>123})
NodeTypes["3"] = NodeTypesClass.new("1","item 1",{"muffin"=>123})

Welcome!

This is definitely a work in progress, and I welcome all contributions to make this the best GDScript Dictionary to Crystal Hash converter ever!