Minetest Lua API syntax highlighting for Notepad++

Post Reply
User avatar
v-rob
Developer
Posts: 846
Joined: Thu Mar 24, 2016 03:19
GitHub: v-rob
IRC: v-rob
Location: Right behind you.

Minetest Lua API syntax highlighting for Notepad++

by v-rob » Post

I use Notepad++ for all code I write, and I consider it much better than Atom and VSCode and suchlike (smaller size, less RAM usage, and all the features I've ever needed). I like function highlighting, so I went through the Lua API and added all the functions, globals, classes, and methods from the Lua API.

It's not perfect, since I just added it to the existing syntax highligher for Lua (I'm too lazy to do anything else), it might be a bit out of date, since I made this a version or two ago, and it might have some typos. If you notice any problems, go ahead and say so.

So, to use, go to Settings -> Style Configurator..., click on Lua in the language selector, and copy these into the FUNC1, FUNC2, or FUNC3 user-defined keywords section. Then click Save & Close, and you're all set.

Globals and classes (I used FUNC1):

Code: Select all

minetest
vector
VoxelArea
RayCast
AreaStore
PcgRandom
PerlinNoise
PerlinNoiseMap
PseudoRandom
SecureRandom
Settings
minetest.registered_items
minetest.registered_nodes
minetest.registered_craftitems
minetest.registered_tools
minetest.registered_entities
minetest.object_refs
minetest.luaentities
minetest.registered_abms
minetest.registered_lbms
minetest.registered_aliases
minetest.registered_ores
minetest.registered_biomes
minetest.registered_decorations
minetest.registered_schematics
minetest.registered_privleges
minetest.CONTENT_UNKNOWN
minetest.CONTENT_AIR
minetest.CONTENT_IGNORE
minetest.EMERGE_CANCELLED
minetest.EMERGE_ERRORED
minetest.EMERGE_FROM_MEMORY
minetest.EMERGE_FROM_DISK
minetest.EMERGE_GENERATED
minetest.PLAYER_MAX_HP_DEFAULT
minetest.PLAYER_MAX_BREATH_DEFAULT
Minetest extensions of Lua Standard Library (I highly suggest FUNC2 since it makes sense there):

Code: Select all

string.split
split
string.trim
trim
dump2
math.hypot
math.sign
math.factorial
table.indexof
table.insert_all
table.equals
table.copy
Functions and methods (I used FUNC3):

Code: Select all

vector.new
vector.direction
vector.distance
vector.length
vector.normalize
vector.floor
vector.round
vector.apply
vector.equals
vector.sort
vector.angle
vector.add
vector.subtract
vector.multiply
vector.divide
minetest.get_color_escape_sequence
minetest.colorize
minetest.get_background_escape_sequence
minetest.strip_foreground_colors
minetest.strip_background_colors
minetest.strip_colors
minetest.wrap_text
minetest.pos_to_string
minetest.string_to_pos
minetest.string_to_area
minetest.formspec_escape
minetest.is_yes
minetest.is_nan
minetest.get_us_time
minetest.pointed_thing_to_face_pos
minetest.get_dig_params
minetest.get_hit_params
minetest.get_translator
minetest.translate
minetest.get_current_modname
minetest.get_modpath
minetest.get_modnames
minetest.get_worldpath
minetest.is_singleplayer
minetest.features
minetest.has_feature
minetest.get_player_information
minetest.mkdir
minetest.get_dir_list
minetest.safe_file_write
minetest.get_version
minetest.sha1
minetest.debug
minetest.log
minetest.register_item
minetest.register_node
minetest.register_craftitem
minetest.register_tool
minetest.override_item
minetest.unregister_item
minetest.register_entity
minetest.register_abm
minetest.register_lbm
minetest.register_alias
minetest.register_alias_force
minetest.register_ore
minetest.register_biome
minetest.unregister_biome
minetest.register_decoration
minetest.register_schematic
minetest.clear_registered_ores
minetest.clear_registered_biomes
minetest.clear_registered_schematics
minetest.register_craft
minetest.clear_craft
minetest.register_chatcommand
minetest.override_chatcommand
minetest.unregister_chatcommand
minetest.register_privilege
minetest.register_authentification_handler
minetest.register_globalstep
minetest.register_on_mods_loaded
minetest.register_on_shutdown
minetest.register_on_placenode
minetest.register_on_dignode
minetest.register_on_punchnode
minetest.register_on_generated
minetest.register_on_newplayer
minetest.register_on_punchplayer
minetest.register_on_player_hp_change
minetest.register_on_dieplayer
minetest.register_on_respawnplayer
minetest.register_on_prejoinplayer
minetest.register_on_joinplayer
minetest.register_on_leaveplayer
minetest.register_on_auth_fail
minetest.register_on_cheat
minetest.register_on_chat_message
minetest.register_on_player_receive_fields
minetest.register_on_craft
minetest.register_craft_predict
minetest.register_allow_player_inventory_action
minetest.register_on_player_inventory_action
minetest.register_on_protection_violation
minetest.register_on_item_eat
minetest.register_on_priv_grant
minetest.register_on_priv_revoke
minetest.register_can_bypass_userlimit
minetest.register_on_modchannel_message
minetest.settings
minetest.setting_get_pos
minetest.string_to_privs
minetest.privs_to_string
minetest.get_player_privs
minetest.check_player_privs
minetest.check_password_entry
minetest.get_password_hash
minetest.get_player_ip
minetest.get_auth_handler
minetest.notify_authentification_modified
minetest.set_player_password
minetest.set_player_privs
minetest.auth_reload
minetest.chat_send_all
minetest.chat_send_player
minetest.set_node
minetest.add_node
minetest.bulk_set_node
minetest.swap_node
minetest.remove_node
minetest.get_node
minetest.get_node_or_nil
minetest.get_node_light
minetest.place_node
minetest.dig_node
minetest.punch_node
minetest.spawn_falling_node
minetest.find_nodes_with_meta
minetest.get_meta
minetest.get_node_timer
minetest.add_entity
minetest.add_item
minetest.get_player_by_name
minetest.get_objects_inside_radius
minetest.set_timeofday
minetest.get_timeofday
minetest.get_gametime
minetest.get_day_count
minetest.find_node_near
minetest.find_nodes_in_area
minetest.find_nodes_in_area_under_air
minetest.get_perlin
minetest.get_voxel_manip
minetest.set_gen_notify
minetest.get_gen_notify
minetest.get_decoration_id
minetest.get_mapgen_object
minetest.get_heat
minetest.get_humidity
minetest.get_biome_data
minetest.get_biome_id
minetest.get_biome_name
minetest.get_mapgen_setting
minetest.set_mapgen_setting
minetest.set_mapgen_setting_noiseparams
minetest.set_noiseparams
minetest.generate_ores
minetest.generate_decorations
minetest.clear_objects
minetest.load_area
minetest.emerge_area
minetest.delete_area
minetest.line_of_sight
minetest.raycast
minetest.find_path
minetest.spawn_tree
minetest.transforming_liquid_add
minetest.get_node_max_level
minetest.get_node_level
minetest.set_node_level
minetest.add_node_level
minetest.fix_light
minetest.check_single_for_falling
minetest.check_for_falling
minetest.get_spawn_level
minetest.mod_channel_join
minetest.get_inventory
minetest.create_detached_inventory
minetest.remove_detached_inventory
minetest.do_item_eat
minetest.show_formspec
minetest.close_formspec
minetest.explode_table_event
minetest.explode_textlist_event
minetest.explode_scrollbar_event
minetest.inventorycube
minetest.get_pointed_thing_position
minetest.dir_to_facedir
minetest.facedir_to_dir
minetest.dir_to_wallmounted
minetest.wallmounted_to_dir
minetest.dir_to_yaw
minetest.yaw_to_dir
minetest.is_colored_paramtype
minetest.strip_param2_color
minetest.get_node_drops
minetest.get_craft_result
minetest.get_craft_recipe
minetest.get_all_craft_recipes
minetest.handle_node_drops
minetest.itemstring_with_palette
minetest.itemstring_with_color
minetest.rollback_get_node_actions
minetest.rollback_revert_actions_by
minetest.item_place_node
minetest.item_place_object
minetest.item_place
minetest.item_drop
minetest.item_eat
minetest.node_punch
minetest.node_dig
minetest.sound_play
minetest.sound_stop
minetest.sound_fade
minetest.after
minetest.request_shutdown
minetest.cancel_shutdown_requests
minetest.get_server_status
minetest.get_server_uptime
minetest.remove_player
minetest.remove_player_auth
minetest.get_ban_list
minetest.get_ban_description
minetest.ban_player
minetest.unban_player_or_ip
minetest.kick_player
minetest.add_particle
minetest.add_particlespawner
minetest.delete_particlespawner
minetest.create_schematic
minetest.place_schematic
minetest.place_schematic_on_vmanip
minetest.serialize_schematic
minetest.request_http_api
minetest.get_mod_storage
minetest.get_connected_players
minetest.is_player
minetest.player_exists
minetest.hud_replace_builtin
minetest.send_join_message
minetest.send_leave_message
minetest.hash_node_position
minetest.get_position_from_hash
minetest.get_item_group
minetest.get_node_group
minetest.raillike_group
minetest.get_content_id
minetest.get_name_from_content_id
minetest.parse_json
minetest.write_json
minetest.serialize
minetest.deserialize
minetest.compress
minetest.decompress
minetest.rgba
minetest.encode_base64
minetest.decode_base64
minetest.is_protected
minetest.record_protection_violation
minetest.is_area_protected
minetest.rotate_and_place
minetest.rotate_node
minetest.forceload_block
minetest.forceload_free_block
minetest.request_insecure_environment
minetest.global_exists
read_from_map
write_to_map
get_node_at
set_node_at
get_data
set_data
update_map
set_lighting
get_light_data
set_light_data
get_param2_data
set_param2_data
calc_lighting
update_liquids
was_modified
get_emerged_area
new
getExtent
getVolume
index
indexp
position
contains
containsp
containsi
iter
iterp
on_activate
on_step
on_punch
on_death
on_rightclick
on_attach_child
on_detach_child
on_detach
get_staticdata
fetch
fetch_async
fetch_async_get
get_area
get_areas_for_pos
get_areas_in_area
insert_area
reserve
remove_area
set_cache_params
to_string
to_file
from_string
from_file
is_empty
get_size
set_size
get_width
set_width
get_stack
set_stack
get_list
set_list
get_lists
set_lists
add_item
room_for_item
contains_item
remove_item
get_location
get_name
set_name
get_count
set_count
get_wear
set_wear
get_meta
get_metadata
set_metadata
clear
replace
to_table
get_stack_max
get_free_space
is_known
get_definition
get_tool_capabilities
add_wear
item_fits
take_item
peek_item
set_tool_capabilities
contains
get
set_string
get_string
set_int
get_int
set_float
get_float
to_table
from_table
equals
leave
is_writeable
send_all
get_inventory
mark_as_private
set
start
stop
get_timeout
get_elapsed
is_started
get_pos
set_pos
move_to
punch
right_click
get_hp
set_hp
get_weild_list
get_weild_index
get_wielded_item
set_weilded_item
get_armor_groups
set_armor_groups
get_animation
set_animation
set_animation_frame_speed
set_attach
get_attach
set_detach
set_bone_position
get_bone_position
set_properties
get_properties
is_player
get_nametag_attributes
set_nametag_attributes
set_velocity
get_velocity
add_velocity
set_acceleration
get_acceleration
set_rotation
get_rotation
set_yaw
get_yaw
set_texture_mod
get_texture_mod
set_sprite
get_luaentity
get_player_name
get_player_velocity
get_look_dir
get_look_vertical
get_look_horizontal
get_look_vertical
set_look_horizontal
set_look_vertical
get_breath
set_breath
get_meta
set_inventory_formspec
set_formspec_prepend
get_formspec_prepend
get_player_control
get_player_control_bits
set_physics_override
get_physics_override
hud_add
hud_remove
hud_change
hud_get
hud_set_flags
hud_get_flags
hud_set_hotbar_itemcount
hud_get_hotbar_itemcount
hud_set_hotbar_image
hud_get_hotbar_image
hud_set_hotbar_selected_image
hud_get_hotbar_selected_image
set_sky
get_sky
set_clouds
get_clouds
override_day_night_ratio
get_day_night_ratio
get_local_animation
set_eye_offset
get_eye_offset
send_mapblock
next
rand_normal_dist
get_2d
get_3d
get_2d_map
get_3d_map
get_2d_map_flat
get_3d_map_flat
calc_2d_map
calc_3d_map
get_map_slice
next_bytes
get
get_bool
get_np_group
set
set_bool
remove
get_names
write
Enjoy!
GUI Core Developer | My Best Mods: Bridger - Slats - Stained Glass | To contact me, send a PM

User avatar
FreeLikeGNU
Member
Posts: 231
Joined: Tue Oct 28, 2014 02:50
GitHub: FreeLikeGNU
IRC: freelikegnu
In-game: FreeLikeGNU

Re: Minetest Lua API syntax highlighting for Notepad++

by FreeLikeGNU » Post

I tried this with the function list here: https://stackoverflow.com/a/21480438 out of curiosity.. Thank you for the syntax highlighter, v-rob! I really like it even though I need to run it in wine. Indent by fold plugin is also handy!
Image

Dragonop
Member
Posts: 1232
Joined: Tue Oct 23, 2012 12:59
GitHub: Dragonop
IRC: Dragonop
In-game: Dragonop
Location: Argentina

Re: Minetest Lua API syntax highlighting for Notepad++

by Dragonop » Post

Bump and big thanks!
Now we just need autocompletion...

User avatar
rubenwardy
Moderator
Posts: 6449
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: United Kingdom
Contact:

Re: Minetest Lua API syntax highlighting for Notepad++

by rubenwardy » Post

I know it's not Notepad++, but the VSCode plugin has autocomplete. Although, it's not fully context-aware as determining types in Lua is difficult without running it

CodeMiner
New member
Posts: 4
Joined: Thu Jan 14, 2021 17:08

Re: Minetest Lua API syntax highlighting for Notepad++

by CodeMiner » Post

Need one for Atom.

User avatar
v-rob
Developer
Posts: 846
Joined: Thu Mar 24, 2016 03:19
GitHub: v-rob
IRC: v-rob
Location: Right behind you.

Re: Minetest Lua API syntax highlighting for Notepad++

by v-rob » Post

Then either find one for Atom somewhere else or convert what I have here. I use Notepad++ because it's simple, fast, and has enough features for me, and that's what this topic is about. I personally have no interest in figuring out any other editors.
GUI Core Developer | My Best Mods: Bridger - Slats - Stained Glass | To contact me, send a PM

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests