aboutsummaryrefslogtreecommitdiff
path: root/advtrains_luaautomation/mesecon_controller.lua
diff options
context:
space:
mode:
Diffstat (limited to 'advtrains_luaautomation/mesecon_controller.lua')
0 files changed, 0 insertions, 0 deletions
73'>73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
-- test the serialization function


package.path  =  "../?.lua;" .. package.path


ser = require("serialize")


local mock_file = {}
_G.mock_file = mock_file
function mock_file:read(arg)
	if arg == "*l" then
		local l = self.lines[self.pointer or 1]
		self.pointer = (self.pointer or 1) + 1
		return l
	end
end

function mock_file:close()
	return nil
end

function mock_file:write(text)
	self.content = self.content..text
end

function mock_file:create(lines)
	local f = {}
	setmetatable(f, mock_file)
	f.lines = lines or {}
	f.write = self.write
	f.close = self.close