rua 0.4.5-mswin32 → 0.4.6-mswin32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/ext/rua.c +20 -3
  2. data/lib/i386-mswin32/rua.so +0 -0
  3. metadata +2 -2
data/ext/rua.c CHANGED
@@ -36,7 +36,7 @@ __declspec(dllexport) void Init_rua(void);
36
36
  #define RARRAY_LEN(s) (RARRAY(s)->len)
37
37
  #endif
38
38
 
39
- #define VERSION "0.4.5"
39
+ #define VERSION "0.4.6"
40
40
  #define REF_RBOBJ "self"
41
41
 
42
42
  #define ICONV_JIS "ISO-2022-JP"
@@ -292,7 +292,7 @@ static VALUE rua_openlibs(int argc, VALUE *argv, VALUE self) {
292
292
  static VALUE rua_eval(VALUE self, VALUE str) {
293
293
  struct rua *p;
294
294
  VALUE errinfo;
295
- const char *errmsg;
295
+ const char *errmsg = NULL;
296
296
  int pretop, result = -1;
297
297
 
298
298
  Check_Type(str, T_STRING);
@@ -303,7 +303,24 @@ static VALUE rua_eval(VALUE self, VALUE str) {
303
303
  }
304
304
 
305
305
  pretop = lua_gettop(p->L);
306
- luaL_loadstring(p->L, RSTRING_PTR(str));
306
+
307
+ if (luaL_loadstring(p->L, RSTRING_PTR(str)) != 0) {
308
+ int curtop = lua_gettop(p->L);
309
+
310
+ if (!lua_isnil(p->L, -1)) {
311
+ errmsg = lua_tostring(p->L, -1);
312
+ }
313
+
314
+ if (errmsg == NULL) {
315
+ errmsg = "(error object is not a string)";
316
+ }
317
+
318
+ if (curtop - pretop > 0) {
319
+ lua_pop(p->L, curtop - pretop);
320
+ }
321
+
322
+ rb_raise(RuaError, "%s", errmsg);
323
+ }
307
324
 
308
325
  TRAP_BEG;
309
326
  result = lua_pcall(p->L, 0, LUA_MULTRET, 0);
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rua
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.5
4
+ version: 0.4.6
5
5
  platform: mswin32
6
6
  authors:
7
7
  - winebarrel
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-09-15 00:00:00 +09:00
12
+ date: 2008-09-21 00:00:00 +09:00
13
13
  default_executable:
14
14
  dependencies: []
15
15