New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add more getter functions/methods for the Lua API #1496
Comments
It would be a major security concern if adding this functionality would even be possible. |
OK, then let’s throw this part of the suggestion out of the window then. The rest of the suggestion still stands, of course. |
Minetest stores passwords hashed and (mildly) salted, so getting the original password should be impossible without brute-forcing it. However, you can easily get the password hash from |
getting the original password is impossible without brute-forcing! |
Security problems! honestly? modders have unlimited access to the io functions, that's the problem. |
that's easy function minetest.compare_player_password(name, password)
return minetest.get_password_hash(name, password) == minetest.auth_table[name].password
end |
Cool. It should be in builtin :) |
@ShadowNinja because you are working on mod_security can you provide us some advices on this issue ? |
@nerzhul: This doesn't interact with mod security. |
This can get closed now. c0335f7 |
Thank you very much! Finally it is in. :-) |
The Lua API has a lot of setter functions/methods (for setting a value) but it lacks many corresponding getter functions (for receiving a value). I suggest to add these getter functions.
I personally think there is in most cases no reason not to have such functions. It is just inconsistent and incomplete.
The suggested function/method names are like the setter functions, but with “get” instead of “set”. There is a single exception. After the arrow, I write the suggested return value. It is just the same as the input parameters. Remember that Lua functions can return multiple values at once, for example:
return 1,2,3,4
. I wrote the functions which I consider the most important in bold type.So, here I list the functions I think are lacking in the Lua API:
For
ObjectRef
s:get_properties
→object_property_table
get_armor_groups
→table_of_group_ratings
(I tested it with theluacmd
mod this function does not exist for players; since players are basicallyObjectRef
s, I conclude that this is true for otherObjectRef
s as well)get_animation
→group_rating_table, frame_speed, frame_blend
get_attach
→parent, bone, position, rotation
get_bone_position
→bone, position, rotation
For player objects:
get_physics_override
→ the same table used as input forset_physics_override
hud_get_hotbar_itemcount
→ numberhud_get_hotbar_image
→ texture pathhud_get_hotbar_selected_image
→ texture pathget_sky
→bgcolor, type, {texture names}
get_day_night_ratio
(getter function for tooverride_day_night_ratio
) → ratio ornil
get_local_animation
→ see input parameters ofset_local_animation
get_eye_offset
→first_person_offset, third_person_offset
Global functions:
minetest.get_gen_notify
→ flags (astring
)minetest.get_player_password
(OK, let’s just forget this suggestion, shall we?)minetest.get_mapgen_params
→MapgenParams
minetest.get_noiseparam_defaults
→ seeminetest.set_noiseparam_defaults
For all suggested function names, I checked
lua_api.txt
if it already exists. It did not.If you think I missed a function, please write a comment.
The text was updated successfully, but these errors were encountered: