@@ -228,6 +228,7 @@ pub fn lua_upvalueindex(i: c_int) -> c_int {
228
228
}
229
229
230
230
#[ cfg( any( feature = "lua51" , feature = "luajit" ) ) ]
231
+ #[ inline( always) ]
231
232
pub unsafe fn lua_absindex ( L : * mut lua_State , mut idx : c_int ) -> c_int {
232
233
if idx < 0 && idx > lua:: LUA_REGISTRYINDEX {
233
234
idx += lua_gettop ( L ) + 1 ;
@@ -279,13 +280,15 @@ pub unsafe fn lua_rotate(L: *mut lua_State, mut idx: c_int, mut n: c_int) {
279
280
}
280
281
281
282
#[ cfg( any( feature = "lua51" , feature = "luajit" ) ) ]
283
+ #[ inline( always) ]
282
284
pub unsafe fn lua_copy ( L : * mut lua_State , fromidx : c_int , toidx : c_int ) {
283
285
let abs_to = lua_absindex ( L , toidx) ;
284
286
luaL_checkstack ( L , 1 , cstr ! ( "not enough stack slots" ) ) ;
285
287
lua_pushvalue ( L , fromidx) ;
286
288
lua_replace ( L , abs_to) ;
287
289
}
288
290
291
+ #[ inline( always) ]
289
292
pub unsafe fn lua_isinteger ( L : * mut lua_State , idx : c_int ) -> c_int {
290
293
if lua_type ( L , idx) == lua:: LUA_TNUMBER {
291
294
let n = lua_tonumber ( L , idx) ;
@@ -298,6 +301,7 @@ pub unsafe fn lua_isinteger(L: *mut lua_State, idx: c_int) -> c_int {
298
301
}
299
302
300
303
#[ cfg( any( feature = "lua51" , feature = "luajit" ) ) ]
304
+ #[ inline( always) ]
301
305
pub unsafe fn lua_tonumberx ( L : * mut lua_State , i : c_int , isnum : * mut c_int ) -> lua_Number {
302
306
let n = lua_tonumber ( L , i) ;
303
307
if !isnum. is_null ( ) {
@@ -312,6 +316,7 @@ pub unsafe fn lua_tonumberx(L: *mut lua_State, i: c_int, isnum: *mut c_int) -> l
312
316
313
317
// Implemented for Lua 5.2 as well
314
318
// See https://github.com/keplerproject/lua-compat-5.3/issues/40
319
+ #[ inline( always) ]
315
320
pub unsafe fn lua_tointegerx ( L : * mut lua_State , i : c_int , isnum : * mut c_int ) -> lua_Integer {
316
321
let mut ok = 0 ;
317
322
let n = lua_tonumberx ( L , i, & mut ok) ;
@@ -329,11 +334,13 @@ pub unsafe fn lua_tointegerx(L: *mut lua_State, i: c_int, isnum: *mut c_int) ->
329
334
}
330
335
331
336
#[ cfg( any( feature = "lua51" , feature = "luajit" ) ) ]
337
+ #[ inline( always) ]
332
338
pub unsafe fn lua_rawlen ( L : * mut lua_State , idx : c_int ) -> usize {
333
339
lua_objlen ( L , idx)
334
340
}
335
341
336
342
#[ cfg( any( feature = "lua51" , feature = "luajit" ) ) ]
343
+ #[ inline( always) ]
337
344
pub unsafe fn lua_compare ( L : * mut lua_State , mut idx1 : c_int , mut idx2 : c_int , op : c_int ) -> c_int {
338
345
match op {
339
346
lua:: LUA_OPEQ => lua_equal ( L , idx1, idx2) ,
@@ -354,6 +361,7 @@ pub unsafe fn lua_compare(L: *mut lua_State, mut idx1: c_int, mut idx2: c_int, o
354
361
}
355
362
356
363
#[ cfg( any( feature = "lua51" , feature = "luajit" ) ) ]
364
+ #[ inline( always) ]
357
365
pub unsafe fn lua_pushlstring ( L : * mut lua_State , s : * const c_char , l : usize ) -> * const c_char {
358
366
if l == 0 {
359
367
lua_pushlstring_old ( L , cstr ! ( "" ) , 0 ) ;
@@ -364,6 +372,7 @@ pub unsafe fn lua_pushlstring(L: *mut lua_State, s: *const c_char, l: usize) ->
364
372
}
365
373
366
374
#[ cfg( feature = "lua52" ) ]
375
+ #[ inline( always) ]
367
376
pub unsafe fn lua_pushlstring ( L : * mut lua_State , s : * const c_char , l : usize ) -> * const c_char {
368
377
if l == 0 {
369
378
lua_pushlstring_old ( L , cstr ! ( "" ) , 0 )
@@ -373,27 +382,32 @@ pub unsafe fn lua_pushlstring(L: *mut lua_State, s: *const c_char, l: usize) ->
373
382
}
374
383
375
384
#[ cfg( any( feature = "lua51" , feature = "luajit" ) ) ]
385
+ #[ inline( always) ]
376
386
pub unsafe fn lua_pushstring ( L : * mut lua_State , s : * const c_char ) -> * const c_char {
377
387
lua_pushstring_old ( L , s) ;
378
388
lua_tostring ( L , -1 )
379
389
}
380
390
381
391
#[ cfg( feature = "lua52" ) ]
392
+ #[ inline( always) ]
382
393
pub unsafe fn lua_getglobal ( L : * mut lua_State , var : * const c_char ) -> c_int {
383
394
lua_getglobal_old ( L , var) ;
384
395
lua_type ( L , -1 )
385
396
}
386
397
398
+ #[ inline( always) ]
387
399
pub unsafe fn lua_gettable ( L : * mut lua_State , idx : c_int ) -> c_int {
388
400
lua_gettable_old ( L , idx) ;
389
401
lua_type ( L , -1 )
390
402
}
391
403
404
+ #[ inline( always) ]
392
405
pub unsafe fn lua_getfield ( L : * mut lua_State , idx : c_int , k : * const c_char ) -> c_int {
393
406
lua_getfield_old ( L , idx, k) ;
394
407
lua_type ( L , -1 )
395
408
}
396
409
410
+ #[ inline( always) ]
397
411
pub unsafe fn lua_geti ( L : * mut lua_State , mut idx : c_int , n : lua_Integer ) -> c_int {
398
412
idx = lua_absindex ( L , idx) ;
399
413
lua_pushinteger ( L , n) ;
@@ -402,18 +416,21 @@ pub unsafe fn lua_geti(L: *mut lua_State, mut idx: c_int, n: lua_Integer) -> c_i
402
416
}
403
417
404
418
// A new version which returns c_int
419
+ #[ inline( always) ]
405
420
pub unsafe fn lua_rawget ( L : * mut lua_State , idx : c_int ) -> c_int {
406
421
lua_rawget_old ( L , idx) ;
407
422
lua_type ( L , -1 )
408
423
}
409
424
410
425
// A new version which returns c_int
426
+ #[ inline( always) ]
411
427
pub unsafe fn lua_rawgeti ( L : * mut lua_State , idx : c_int , n : lua_Integer ) -> c_int {
412
428
lua_rawgeti_old ( L , idx, n) ;
413
429
lua_type ( L , -1 )
414
430
}
415
431
416
432
#[ cfg( any( feature = "lua51" , feature = "luajit" ) ) ]
433
+ #[ inline( always) ]
417
434
pub unsafe fn lua_rawgetp ( L : * mut lua_State , idx : c_int , p : * const c_void ) -> c_int {
418
435
let abs_i = lua_absindex ( L , idx) ;
419
436
lua_pushlightuserdata ( L , p as * mut c_void ) ;
@@ -422,23 +439,27 @@ pub unsafe fn lua_rawgetp(L: *mut lua_State, idx: c_int, p: *const c_void) -> c_
422
439
}
423
440
424
441
#[ cfg( feature = "lua52" ) ]
442
+ #[ inline( always) ]
425
443
pub unsafe fn lua_rawgetp ( L : * mut lua_State , idx : c_int , p : * const c_void ) -> c_int {
426
444
lua_rawgetp_old ( L , idx, p) ;
427
445
lua_type ( L , -1 )
428
446
}
429
447
430
448
#[ cfg( any( feature = "lua51" , feature = "luajit" ) ) ]
449
+ #[ inline( always) ]
431
450
pub unsafe fn lua_getuservalue ( L : * mut lua_State , idx : c_int ) -> c_int {
432
451
lua_getfenv ( L , idx) ;
433
452
lua_type ( L , -1 )
434
453
}
435
454
436
455
#[ cfg( feature = "lua52" ) ]
456
+ #[ inline( always) ]
437
457
pub unsafe fn lua_getuservalue ( L : * mut lua_State , idx : c_int ) -> c_int {
438
458
lua_getuservalue_old ( L , idx) ;
439
459
lua_type ( L , -1 )
440
460
}
441
461
462
+ #[ inline( always) ]
442
463
pub unsafe fn lua_seti ( L : * mut lua_State , mut idx : c_int , n : lua_Integer ) {
443
464
luaL_checkstack ( L , 1 , cstr ! ( "not enough stack slots available" ) ) ;
444
465
idx = lua_absindex ( L , idx) ;
@@ -448,6 +469,7 @@ pub unsafe fn lua_seti(L: *mut lua_State, mut idx: c_int, n: lua_Integer) {
448
469
}
449
470
450
471
#[ cfg( any( feature = "lua51" , feature = "luajit" ) ) ]
472
+ #[ inline( always) ]
451
473
pub unsafe fn lua_rawsetp ( L : * mut lua_State , idx : c_int , p : * const c_void ) {
452
474
let abs_i = lua_absindex ( L , idx) ;
453
475
luaL_checkstack ( L , 1 , cstr ! ( "not enough stack slots" ) ) ;
@@ -457,11 +479,13 @@ pub unsafe fn lua_rawsetp(L: *mut lua_State, idx: c_int, p: *const c_void) {
457
479
}
458
480
459
481
#[ cfg( any( feature = "lua51" , feature = "luajit" ) ) ]
482
+ #[ inline( always) ]
460
483
pub unsafe fn lua_setuservalue ( L : * mut lua_State , idx : c_int ) {
461
484
luaL_checktype ( L , -1 , lua:: LUA_TTABLE ) ;
462
485
lua_setfenv ( L , idx) ;
463
486
}
464
487
488
+ #[ inline( always) ]
465
489
pub unsafe fn lua_dump (
466
490
L : * mut lua_State ,
467
491
writer : lua_Writer ,
@@ -472,11 +496,13 @@ pub unsafe fn lua_dump(
472
496
}
473
497
474
498
#[ cfg( any( feature = "lua51" , feature = "luajit" ) ) ]
499
+ #[ inline( always) ]
475
500
pub unsafe fn lua_resume ( L : * mut lua_State , _from : * mut lua_State , narg : c_int ) -> c_int {
476
501
lua_resume_old ( L , narg)
477
502
}
478
503
479
504
#[ cfg( any( feature = "lua51" , feature = "luajit" ) ) ]
505
+ #[ inline( always) ]
480
506
pub unsafe fn lua_len ( L : * mut lua_State , idx : c_int ) {
481
507
match lua_type ( L , idx) {
482
508
lua:: LUA_TSTRING => {
@@ -498,6 +524,7 @@ pub unsafe fn lua_len(L: *mut lua_State, idx: c_int) {
498
524
}
499
525
}
500
526
527
+ #[ inline( always) ]
501
528
pub unsafe fn lua_stringtonumber ( L : * mut lua_State , s : * const c_char ) -> usize {
502
529
use std:: str:: FromStr ;
503
530
@@ -575,6 +602,7 @@ pub unsafe fn lua_pushglobaltable(L: *mut lua_State) {
575
602
//
576
603
577
604
#[ cfg( any( feature = "lua51" , feature = "luajit" ) ) ]
605
+ #[ inline( always) ]
578
606
pub unsafe fn luaL_checkstack ( L : * mut lua_State , sz : c_int , msg : * const c_char ) {
579
607
if lua_checkstack ( L , sz + lua:: LUA_MINSTACK ) == 0 {
580
608
if !msg. is_null ( ) {
@@ -590,6 +618,7 @@ pub unsafe fn luaL_checkversion(_L: *mut lua_State) {
590
618
// Void
591
619
}
592
620
621
+ #[ inline( always) ]
593
622
pub unsafe fn luaL_getmetafield ( L : * mut lua_State , obj : c_int , e : * const c_char ) -> c_int {
594
623
if luaL_getmetafield_old ( L , obj, e) != 0 {
595
624
lua_type ( L , -1 )
@@ -598,6 +627,7 @@ pub unsafe fn luaL_getmetafield(L: *mut lua_State, obj: c_int, e: *const c_char)
598
627
}
599
628
}
600
629
630
+ #[ inline( always) ]
601
631
pub unsafe fn luaL_newmetatable ( L : * mut lua_State , tname : * const c_char ) -> c_int {
602
632
if luaL_newmetatable_old ( L , tname) != 0 {
603
633
lua_pushstring ( L , tname) ;
@@ -609,6 +639,7 @@ pub unsafe fn luaL_newmetatable(L: *mut lua_State, tname: *const c_char) -> c_in
609
639
}
610
640
611
641
#[ cfg( any( feature = "lua51" , feature = "luajit" ) ) ]
642
+ #[ inline( always) ]
612
643
pub unsafe fn luaL_loadbufferx (
613
644
L : * mut lua_State ,
614
645
buff : * const c_char ,
@@ -628,6 +659,7 @@ pub unsafe fn luaL_loadbufferx(
628
659
}
629
660
630
661
#[ cfg( any( feature = "lua51" , feature = "luajit" ) ) ]
662
+ #[ inline( always) ]
631
663
pub unsafe fn luaL_len ( L : * mut lua_State , idx : c_int ) -> lua_Integer {
632
664
let mut isnum = 0 ;
633
665
luaL_checkstack ( L , 1 , cstr ! ( "not enough stack slots" ) ) ;
@@ -668,7 +700,7 @@ pub unsafe fn luaL_traceback(
668
700
level = numlevels - COMPAT53_LEVELS2 ; // and skip to last ones
669
701
} else {
670
702
lua_getinfo ( L1 , cstr ! ( "Slnt" ) , & mut ar) ;
671
- lua_pushfstring ( L , cstr ! ( "\n \t %s:" ) , cstr ! ( "ok" ) /* ar.short_src*/ ) ;
703
+ lua_pushfstring ( L , cstr ! ( "\n \t %s:" ) , ar. short_src . as_ptr ( ) ) ;
672
704
if ar. currentline > 0 {
673
705
lua_pushfstring ( L , cstr ! ( "%d:" ) , ar. currentline ) ;
674
706
}
@@ -717,13 +749,15 @@ pub unsafe fn luaL_tolstring(L: *mut lua_State, idx: c_int, len: *mut usize) ->
717
749
}
718
750
719
751
#[ cfg( any( feature = "lua51" , feature = "luajit" ) ) ]
752
+ #[ inline( always) ]
720
753
pub unsafe fn luaL_setmetatable ( L : * mut lua_State , tname : * const c_char ) {
721
754
luaL_checkstack ( L , 1 , cstr ! ( "not enough stack slots" ) ) ;
722
755
luaL_getmetatable ( L , tname) ;
723
756
lua_setmetatable ( L , -2 ) ;
724
757
}
725
758
726
759
#[ cfg( any( feature = "lua51" , feature = "luajit" ) ) ]
760
+ #[ inline( always) ]
727
761
pub unsafe fn luaL_testudata ( L : * mut lua_State , i : c_int , tname : * const c_char ) -> * mut c_void {
728
762
let mut p = lua_touserdata ( L , i) ;
729
763
luaL_checkstack ( L , 2 , cstr ! ( "not enough stack slots" ) ) ;
@@ -741,6 +775,7 @@ pub unsafe fn luaL_testudata(L: *mut lua_State, i: c_int, tname: *const c_char)
741
775
}
742
776
743
777
#[ cfg( any( feature = "lua51" , feature = "luajit" ) ) ]
778
+ #[ inline( always) ]
744
779
pub unsafe fn luaL_setfuncs ( L : * mut lua_State , mut l : * const luaL_Reg , nup : c_int ) {
745
780
luaL_checkstack ( L , nup + 1 , cstr ! ( "too many upvalues" ) ) ;
746
781
while !( * l) . name . is_null ( ) {
0 commit comments