Update to Luau 0.548 (luau-src >=0.4)

This commit is contained in:
Alex Orlenko 2022-10-08 23:34:47 +01:00
parent 81a9998559
commit e523fb2c86
No known key found for this signature in database
GPG key ID: 4C150C250863B96D
5 changed files with 13 additions and 4 deletions

View file

@ -58,7 +58,7 @@ cc = { version = "1.0" }
pkg-config = { version = "0.3.17" }
lua-src = { version = ">= 544.0.0, < 550.0.0", optional = true }
luajit-src = { version = ">= 210.4.0, < 220.0.0", optional = true }
luau0-src = { version = "0.3.6", optional = true }
luau0-src = { version = "0.4.0", optional = true }
[dev-dependencies]
rustyline = "10.0"

View file

@ -423,7 +423,7 @@ pub unsafe fn luaL_traceback(
level = numlevels - COMPAT53_LEVELS2; // and skip to last ones
} else {
lua_getinfo(L1, level, cstr!("sln"), &mut ar);
lua_pushfstring(L, cstr!("\n\t%s:"), ar.short_src.as_ptr());
lua_pushfstring(L, cstr!("\n\t%s:"), ar.short_src);
if ar.currentline > 0 {
lua_pushfstring(L, cstr!("%d:"), ar.currentline);
}

View file

@ -257,6 +257,7 @@ extern "C" {
extern "C" {
pub fn lua_error(L: *mut lua_State) -> !;
pub fn lua_next(L: *mut lua_State, idx: c_int) -> c_int;
pub fn lua_rawiter(L: *mut lua_State, idx: c_int, iter: c_int) -> c_int;
pub fn lua_concat(L: *mut lua_State, n: c_int);
// TODO: lua_encodepointer
pub fn lua_clock() -> c_double;
@ -267,6 +268,7 @@ extern "C" {
dtor: Option<unsafe extern "C" fn(*mut lua_State, *mut c_void)>,
);
pub fn lua_clonefunction(L: *mut lua_State, idx: c_int);
pub fn lua_cleartable(L: *mut lua_State, idx: c_int);
}
//
@ -460,13 +462,14 @@ pub struct lua_Debug {
pub name: *const c_char,
pub what: *const c_char,
pub source: *const c_char,
pub short_src: *const c_char,
pub linedefined: c_int,
pub currentline: c_int,
pub nupvals: u8,
pub nparams: u8,
pub isvararg: c_char,
pub short_src: [c_char; LUA_IDSIZE],
pub userdata: *mut c_void,
pub ssbuf: [c_char; LUA_IDSIZE],
}
//

View file

@ -273,7 +273,10 @@ impl<'lua> Function<'lua> {
name_what: None,
what: ptr_to_cstr_bytes(ar.what).map(|s| s.to_vec()),
source: ptr_to_cstr_bytes(ar.source).map(|s| s.to_vec()),
short_src: ptr_to_cstr_bytes(&ar.short_src as *const _).map(|s| s.to_vec()),
#[cfg(not(feature = "luau"))]
short_src: ptr_to_cstr_bytes(ar.short_src.as_ptr()).map(|s| s.to_vec()),
#[cfg(feature = "luau")]
short_src: ptr_to_cstr_bytes(ar.short_src).map(|s| s.to_vec()),
line_defined: ar.linedefined as i32,
#[cfg(not(feature = "luau"))]
last_line_defined: ar.lastlinedefined as i32,

View file

@ -102,7 +102,10 @@ impl<'lua> Debug<'lua> {
DebugSource {
source: ptr_to_cstr_bytes((*self.ar.get()).source),
#[cfg(not(feature = "luau"))]
short_src: ptr_to_cstr_bytes((*self.ar.get()).short_src.as_ptr()),
#[cfg(feature = "luau")]
short_src: ptr_to_cstr_bytes((*self.ar.get()).short_src),
line_defined: (*self.ar.get()).linedefined as i32,
#[cfg(not(feature = "luau"))]
last_line_defined: (*self.ar.get()).lastlinedefined as i32,