From ad6a330ae0449dd80024bdb08c498d1b31a10992 Mon Sep 17 00:00:00 2001 From: Alula <6276139+alula@users.noreply.github.com> Date: Sun, 2 May 2021 04:05:21 +0200 Subject: [PATCH] make lua function casing match docs --- src/scripting/boot.lua | 12 ++++++------ src/scripting/mod.rs | 2 +- src/scripting/player.rs | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/scripting/boot.lua b/src/scripting/boot.lua index 4993777..556d943 100644 --- a/src/scripting/boot.lua +++ b/src/scripting/boot.lua @@ -16,7 +16,7 @@ doukutsu._handlers = setmetatable({ end, }) -doukutsu._initialize_script = function(script) +doukutsu._initializeScript = function(script) -- for compatibility with Lua 5.2+, copy-pasted from Lua mailing list -- http://lua-users.org/lists/lua-l/2010-06/msg00313.html local _setfenv = setfenv or function(f, t) @@ -45,12 +45,12 @@ doukutsu._initialize_script = function(script) script() end -doukutsu.play_sfx = function(id) - __doukutsu:play_sfx(id) +doukutsu.playSfx = function(id) + __doukutsu:playSfx(id) end -doukutsu.play_song = function(id) - __doukutsu:play_song(id) +doukutsu.playSong = function(id) + __doukutsu:playSong(id) end doukutsu.on = function(event, handler) @@ -66,7 +66,7 @@ doukutsu.on = function(event, handler) return handler end -doukutsu.remove_handler = function(event, handler) +doukutsu.removeHandler = function(event, handler) assert(type(event) == "string", "event type must be a string.") assert(type(handler) == "function", "event handler must be a function.") diff --git a/src/scripting/mod.rs b/src/scripting/mod.rs index 5c97342..277ae88 100644 --- a/src/scripting/mod.rs +++ b/src/scripting/mod.rs @@ -87,7 +87,7 @@ impl LuaScriptingState { } state.get_global("doukutsu"); - state.get_field(-1, "_initialize_script"); + state.get_field(-1, "_initializeScript"); state.push_value(-3); let res = state.pcall(1, 0, 0); diff --git a/src/scripting/player.rs b/src/scripting/player.rs index 4edc822..7aab899 100644 --- a/src/scripting/player.rs +++ b/src/scripting/player.rs @@ -126,10 +126,10 @@ impl LuaObject for LuaPlayer { vec![ lua_method!("x", LuaPlayer, LuaPlayer::lua_get_x), lua_method!("y", LuaPlayer, LuaPlayer::lua_get_y), - lua_method!("vel_x", LuaPlayer, LuaPlayer::lua_get_vel_x), - lua_method!("vel_y", LuaPlayer, LuaPlayer::lua_get_vel_y), - lua_method!("set_vel_x", LuaPlayer, LuaPlayer::lua_set_vel_x), - lua_method!("set_vel_y", LuaPlayer, LuaPlayer::lua_set_vel_y), + lua_method!("velX", LuaPlayer, LuaPlayer::lua_get_vel_x), + lua_method!("velX", LuaPlayer, LuaPlayer::lua_get_vel_y), + lua_method!("setVelX", LuaPlayer, LuaPlayer::lua_set_vel_x), + lua_method!("setVelY", LuaPlayer, LuaPlayer::lua_set_vel_y), ] } }