Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local cm2lua = {}
- cm2lua.NOR = 0
- cm2lua.AND = 1
- cm2lua.OR = 2
- cm2lua.XOR = 3
- cm2lua.BUTTON = 4
- cm2lua.FLIPFLOP = 5
- cm2lua.LED = 6
- cm2lua.SOUND = 7
- cm2lua.CONDUCTOR = 8
- cm2lua.NAND = 10
- cm2lua.XNOR = 11
- cm2lua.RANDOM = 12
- cm2lua.TEXT = 13
- cm2lua.TILE = 14
- blocks = {}
- connections = {}
- function cm2lua.addBlock(name, x, y, z, properties)
- str = name..",,"..x..","..y..","..z..","
- if properties then
- for i = 1, #properties do
- str = str .. properties[i]
- if i ~= #properties then
- str = str .. "+"
- end
- end
- end
- table.insert(blocks, str)
- end
- function cm2lua.addConnection(source, target)
- str = source..","..target
- table.insert(connections, str)
- end
- function cm2lua.exportSave()
- savestr = ""
- for i = 1, #blocks do
- savestr = savestr .. blocks[i]
- if i ~= #blocks then
- savestr = savestr .. ";"
- end
- end
- savestr = savestr .. "?"
- for i = 1, #connections do
- savestr = savestr .. connections[i]
- if i ~= #connections then
- savestr = savestr .. ";"
- end
- end
- savestr = savestr .. "??"
- print(savestr)
- end
- cm2 = cm2lua
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement