Comments (12)
我觉得也是彻底解决#11 之类问题的方法
虽然会使得键位绑定的设置分散
from input-event.
先改了一个简单的,获取mpv当前的绑定,覆盖外部配置文件的click。
可以自定义配置文件地址,外部配置的语法和现在的input.conf完全一致
from input-event.
我不理解为什么要把函数局部化。。。
from input-event.
我不理解为什么要把函数局部化。。。
1,局部变量访问更快
2,没有坏处
from input-event.
访问更快是否有验证依据。如果更快mpv内最复杂的osc脚本没理由不使用
from input-event.
访问更快是否有验证依据。如果更快mpv内最复杂的osc脚本没理由不使用
这是lua语言自身的特性,https://stackoverflow.com/questions/9132288/why-are-local-variables-accessed-faster-than-global-variables-in-lua
from input-event.
..这并没有解释我的疑问
假设成立,为什么还有遗漏的函数并没有统一为局部
from input-event.
..这并没有解释我的疑问 假设成立,为什么还有遗漏的函数并没有统一为局部
xx:xx这种函数担心改了会出问题,也懒得查文档,所以懒得改
from input-event.
按照网上的做了测试,用了局部的话最好还是全部统一局部
-- 无报错
local function test()
test1()
test2()
end
function test1()
print("test1")
end
function test2()
print("test2")
end
test()
-- 报错
local function test()
test1()
test2()
end
function test1()
print("test1")
end
local function test2()
print("test2")
end
test()
from input-event.
按照网上的做了测试,用了局部的话最好还是全部统一局部
https://www.lua.org/pil/6.2.html
主要还是变量应该先定义后使用吧,这个脚本里都是先定义,后使用的,所以不会报错
以下不会报错
function test1()
print("test1")
end
local function test2()
print("test2")
end
local function test()
test1()
test2()
end
test()
from input-event.
先声明肯定是不报错啦,这也算是发现一个特性了
from input-event.
..这并没有解释我的疑问 假设成立,为什么还有遗漏的函数并没有统一为局部
xx:xx这种函数担心改了会出问题,也懒得查文档,所以懒得改
补充说明,object:method这种形式的函数,实际上是给object添加函数方法,如果定义为local,则只能在对象内部进行调用,即私有方法,不可以在外部通过object:method()来运行。
https://www.lua.org/pil/16.4.html 说的不太清楚
脚本里的此类函数,分为2类:
1、给lua自带类型增加的方法,都是要在对象外部调用的,不能加local
2、InputEvent对象的方法,有部分方法是被外部调用,new bind unbind rebind,不可被私有化;其余的可以私有化。
要改也可以改
from input-event.
Related Issues (20)
- Supports mutiple input command perfixes HOT 1
- Re-think: event ignore HOT 1
- Bring back the default behavior via repeat ignore HOT 1
- Inline bind/unbind HOT 1
- Improve `command.split(";")` HOT 1
- Update document
- Delay on Click Commands HOT 2
- Weird behavior with `#@press` when triggering another command at the same time HOT 2
- It broke scroll-list.lua functionality HOT 10
- [REQUEST] 'Long' press event HOT 2
- [Question] How to write ignore statement in json conf HOT 2
- Remove "Left-click will be ignored for a short time after the focus window" HOT 13
- Re-think "How to integrate with other scripts"
- Support mpv.net v7 HOT 1
- Is there a way to not play/pause while dragging ? HOT 4
- I need to click 3 times to get double click. HOT 10
- MBTN_LEFT dragging window conflicts with mpv-player/mpv#14251 HOT 9
- Move array like command to string converter to constructor
- Use "event:" to replace "@" as a prefix
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from input-event.