File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2075,8 +2075,10 @@ pub const Lua = opaque {
20752075 /// * Lua Errors: `never`
20762076 ///
20772077 /// See https://www.lua.org/manual/5.4/manual.html#lua_pushlightuserdata
2078- pub fn pushLightUserdata (lua : * Lua , ptr : * anyopaque ) void {
2079- c .lua_pushlightuserdata (@as (* LuaState , @ptrCast (lua )), ptr );
2078+ pub fn pushLightUserdata (lua : * Lua , ptr : * const anyopaque ) void {
2079+ // Use @constCast and a *const anyopaque to allow this function to accept constant pointers. Lua doesn't ever modify
2080+ // the pointer so this should be safe, and makes pushLightUserdata more flexible.
2081+ c .lua_pushlightuserdata (@as (* LuaState , @ptrCast (lua )), @constCast (ptr ));
20802082 }
20812083
20822084 /// Pushes the string pointed to by `str` onto the stack. Lua will make or reuse an internal copy of the given
You can’t perform that action at this time.
0 commit comments