@@ -99,6 +99,18 @@ static void get_config(lua_State* L, yue::YueConfig& config) {
9999 config.lax = lua_toboolean (L, -1 ) != 0 ;
100100 }
101101 lua_pop (L, 1 );
102+ lua_pushliteral (L, " line_offset" );
103+ lua_gettable (L, -2 );
104+ if (lua_isnumber (L, -1 ) != 0 ) {
105+ config.lineOffset = static_cast <int >(lua_tonumber (L, -1 ));
106+ }
107+ lua_pop (L, 1 );
108+ lua_pushliteral (L, " module" );
109+ lua_gettable (L, -2 );
110+ if (lua_isstring (L, -1 ) != 0 ) {
111+ config.module = lua_tostring (L, -1 );
112+ }
113+ lua_pop (L, 1 );
102114 lua_pushliteral (L, " options" );
103115 lua_gettable (L, -2 );
104116 if (lua_istable (L, -1 ) != 0 ) {
@@ -132,18 +144,6 @@ static int yuetolua(lua_State* L) {
132144 if (lua_isboolean (L, -1 ) != 0 ) {
133145 sameModule = lua_toboolean (L, -1 ) != 0 ;
134146 }
135- lua_pop (L, 1 );
136- lua_pushliteral (L, " line_offset" );
137- lua_gettable (L, -2 );
138- if (lua_isnumber (L, -1 ) != 0 ) {
139- config.lineOffset = static_cast <int >(lua_tonumber (L, -1 ));
140- }
141- lua_pop (L, 1 );
142- lua_pushliteral (L, " module" );
143- lua_gettable (L, -2 );
144- if (lua_isstring (L, -1 ) != 0 ) {
145- config.module = lua_tostring (L, -1 );
146- }
147147 lua_pop (L, 2 );
148148 }
149149 auto result = yue::YueCompiler (L, nullptr , sameModule).compile (codes, config);
0 commit comments