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
|
# File 'lib/to_lua/generator.rb', line 97
def to_lua(state = nil)
state = State.from_state(state)
depth = state.depth += 1
fields = []
self.each do |value|
field = ''
field << state.indent * state.depth if state.pretty?
field << value.to_lua(state)
fields << field
end
depth = state.depth -= 1
join_str = state.pretty? ? ",\n" : ','
result = '{'
result << "\n" if state.pretty?
result << fields.join(join_str)
result << "\n" if state.pretty?
result << state.indent * depth if state.pretty?
result << '}'
result
end
|