Skip to content

Commit bc05d40

Browse files
jasonishvictorjulien
authored andcommitted
rust/lua: add method for pushing bytes
Much like pushstring, but accepts an &[u8] as an argument instead of an &str. In support of ticket OISF#8533. (cherry picked from commit 81692dd)
1 parent 1ceea76 commit bc05d40

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

rust/src/lua.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ impl LuaState {
5656
}
5757
}
5858

59+
pub fn pushbytes(&self, val: &[u8]) {
60+
unsafe {
61+
lua_pushlstring(self.lua, val.as_ptr() as *const c_char, val.len());
62+
}
63+
}
64+
5965
pub fn pushinteger(&self, val: i64) {
6066
unsafe {
6167
lua_pushinteger(self.lua, val);

0 commit comments

Comments
 (0)