File tree Expand file tree Collapse file tree 2 files changed +5
-6
lines changed Expand file tree Collapse file tree 2 files changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -800,7 +800,7 @@ test "userdata and uservalues" {
800
800
};
801
801
802
802
// create a Lua-owned pointer to a Data with 2 associated user values
803
- var data = lua .newUserdataUV (Data , 2 );
803
+ var data = lua .newUserdata (Data , 2 );
804
804
data .val = 1 ;
805
805
std .mem .copy (u8 , & data .code , "abcd" );
806
806
@@ -1468,7 +1468,7 @@ test "userdata" {
1468
1468
const Type = struct { a : i32 , b : f32 };
1469
1469
try lua .newMetatable ("Type" );
1470
1470
1471
- var t = lua .newUserdataUV (Type , 0 );
1471
+ var t = lua .newUserdata (Type , 0 );
1472
1472
lua .setMetatableAux ("Type" );
1473
1473
t .a = 1234 ;
1474
1474
t .b = 3.14 ;
Original file line number Diff line number Diff line change @@ -695,13 +695,12 @@ pub const Lua = struct {
695
695
}
696
696
697
697
/// This function creates and pushes a new full userdata onto the stack
698
- /// with `num_uvalue ` associated Lua values, plus an associated block of raw memory with `size` bytes
698
+ /// with `upvalues ` associated Lua values, plus an associated block of raw memory with `size` bytes
699
699
/// Returns the address of the block of memory
700
- /// TODO: rename to newUserdata?
701
- pub fn newUserdataUV (lua : * Lua , comptime T : type , new_uvalue : i32 ) * T {
700
+ pub fn newUserdata (lua : * Lua , comptime T : type , upvalues : i32 ) * T {
702
701
// safe to .? because this function throws a Lua error on out of memory
703
702
// so the returned pointer should never be null
704
- const ptr = c .lua_newuserdatauv (lua .state , @sizeOf (T ), new_uvalue ).? ;
703
+ const ptr = c .lua_newuserdatauv (lua .state , @sizeOf (T ), upvalues ).? ;
705
704
return opaqueCast (T , ptr );
706
705
}
707
706
You can’t perform that action at this time.
0 commit comments