Skip to content

Commit de4d2da

Browse files
committed
clean up comments
1 parent 7343b31 commit de4d2da

File tree

1 file changed

+0
-125
lines changed
  • crates/languages/bevy_mod_scripting_lua/src/bindings

1 file changed

+0
-125
lines changed

crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs

Lines changed: 0 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -35,95 +35,6 @@ impl From<ReflectReference> for LuaReflectReference {
3535
}
3636
}
3737

38-
// Looks up a function in the registry on the given type id
39-
// fn lookup_function(lua: &Lua, key: &str, type_id: TypeId) -> Option<Result<Function, mlua::Error>> {
40-
// let function = lookup_dynamic_function(lua, key, type_id);
41-
42-
// function.map(|mut function| {
43-
// lua.create_function_mut(move |_lua, args: Variadic<LuaScriptValue>| {
44-
// let world = ThreadWorldContainer.get_world();
45-
// let out = function.call_script_function(
46-
// args.into_iter().map(Into::into),
47-
// world,
48-
// LUA_CALLER_CONTEXT,
49-
// )?;
50-
51-
// Ok(LuaScriptValue::from(out))
52-
// })
53-
// })
54-
// }
55-
56-
// fn lookup_function_typed<T: 'static + ?Sized>(
57-
// lua: &Lua,
58-
// key: &str,
59-
// ) -> Option<Result<Function, mlua::Error>> {
60-
// let type_id = TypeId::of::<T>();
61-
// lookup_function(lua, key, type_id)
62-
// }
63-
64-
// fn lookup_dynamic_function(
65-
// _lua: &Lua,
66-
// key: &str,
67-
// type_id: TypeId,
68-
// ) -> Option<DynamicScriptFunction> {
69-
// let function_registry = ThreadWorldContainer
70-
// .get_world()
71-
// .with_resource(|registry: &AppScriptFunctionRegistry| registry.clone());
72-
// let registry = function_registry.read();
73-
74-
// registry
75-
// .get_function(Namespace::OnType(type_id), key.to_string())
76-
// .cloned()
77-
// }
78-
79-
// fn lookup_dynamic_function_typed<T: 'static + ?Sized>(
80-
// lua: &Lua,
81-
// key: &str,
82-
// ) -> Option<DynamicScriptFunction> {
83-
// let type_id = TypeId::of::<T>();
84-
// lookup_dynamic_function(lua, key, type_id)
85-
// }
86-
87-
// fn iter_dynamic_function_overloads(
88-
// _lua: &Lua,
89-
// key: &str,
90-
// type_id: TypeId,
91-
// ) -> impl Iterator<Item = DynamicScriptFunction> {
92-
// let registry = ThreadWorldContainer
93-
// .get_world()
94-
// .with_resource(|registry: &AppScriptFunctionRegistry| registry.clone());
95-
// let registry = registry.read();
96-
97-
// registry
98-
// .iter_overloads(Namespace::OnType(type_id), key.to_string())
99-
// .cloned()
100-
// .collect::<Vec<_>>()
101-
// .into_iter()
102-
// }
103-
104-
// fn try_call_overloads(
105-
// lua: &Lua,
106-
// key: &str,
107-
// type_id: TypeId,
108-
// args: Vec<ScriptValue>,
109-
// world: WorldGuard,
110-
// ) -> Result<LuaScriptValue, InteropError> {
111-
// let overloads = iter_dynamic_function_overloads(lua, key, type_id);
112-
// let mut last_error = None;
113-
// for mut overload in overloads {
114-
// match overload.call_script_function(
115-
// args.clone(),
116-
// world.clone(),
117-
// lua_caller_context(Some(type_id)),
118-
// ) {
119-
// Ok(out) => return Ok(out.into()),
120-
// Err(e) => last_error = Some(e),
121-
// }
122-
// }
123-
124-
// Err(last_error.unwrap_or_else(|| InteropError::missing_function(type_id, key.to_string())))
125-
// }
126-
12738
/// Look up a function on the given type ids
12839
fn lookup_function(
12940
guard: WorldGuard,
@@ -205,13 +116,6 @@ impl UserData for LuaReflectReference {
205116
LUA_CALLER_CONTEXT,
206117
)?;
207118
Ok(LuaScriptValue(out))
208-
// // call the function with the key
209-
// let out = index_func.call_script_function(
210-
// vec![ScriptValue::Reference(self_), key],
211-
// world.clone(),
212-
// lua_caller_context(Some(std::any::TypeId::of::<ReflectReference>())),
213-
// )?;
214-
// LuaScriptValue::from(out).into_lua(lua)
215119
},
216120
);
217121

@@ -222,15 +126,6 @@ impl UserData for LuaReflectReference {
222126
let key: ScriptValue = key.into();
223127
let value: ScriptValue = value.into();
224128

225-
// lookup_dynamic_function_typed::<ReflectReference>(lua, "set")
226-
// .expect("No 'set' function registered for a ReflectReference")
227-
// .call_script_function(
228-
// vec![ScriptValue::Reference(self_), key, value],
229-
// ThreadWorldContainer.get_world(),
230-
// lua_caller_context(Some(std::any::TypeId::of::<ReflectReference>())),
231-
// )?;
232-
// Ok(())
233-
234129
let func = lookup_function(
235130
ThreadWorldContainer.get_world(),
236131
[TypeId::of::<ReflectReference>()],
@@ -256,7 +151,6 @@ impl UserData for LuaReflectReference {
256151
let other: ScriptValue = other.into();
257152
let target_type_id = self_.tail_type_id(world.clone())?.or_fake_id();
258153
let args = vec![ScriptValue::Reference(self_), other];
259-
// Ok(try_call_overloads(lua, "sub", target_type_id, args, world)?)
260154
Ok(try_call_overloads(world, target_type_id, "sub", args)?)
261155
},
262156
);
@@ -269,7 +163,6 @@ impl UserData for LuaReflectReference {
269163
let other: ScriptValue = other.into();
270164
let target_type_id = self_.tail_type_id(world.clone())?.or_fake_id();
271165
let args = vec![ScriptValue::Reference(self_), other];
272-
// Ok(try_call_overloads(lua, "add", target_type_id, args, world)?)
273166
Ok(try_call_overloads(world, target_type_id, "add", args)?)
274167
},
275168
);
@@ -282,7 +175,6 @@ impl UserData for LuaReflectReference {
282175
let other: ScriptValue = other.into();
283176
let target_type_id = self_.tail_type_id(world.clone())?.or_fake_id();
284177
let args = vec![ScriptValue::Reference(self_), other];
285-
// Ok(try_call_overloads(lua, "mul", target_type_id, args, world)?)
286178
Ok(try_call_overloads(world, target_type_id, "mul", args)?)
287179
},
288180
);
@@ -295,7 +187,6 @@ impl UserData for LuaReflectReference {
295187
let other: ScriptValue = other.into();
296188
let target_type_id = self_.tail_type_id(world.clone())?.or_fake_id();
297189
let args = vec![ScriptValue::Reference(self_), other];
298-
// Ok(try_call_overloads(lua, "div", target_type_id, args, world)?)
299190
Ok(try_call_overloads(world, target_type_id, "div", args)?)
300191
},
301192
);
@@ -308,7 +199,6 @@ impl UserData for LuaReflectReference {
308199
let other: ScriptValue = other.into();
309200
let target_type_id = self_.tail_type_id(world.clone())?.or_fake_id();
310201
let args = vec![ScriptValue::Reference(self_), other];
311-
// Ok(try_call_overloads(lua, "rem", target_type_id, args, world)?)
312202
Ok(try_call_overloads(world, target_type_id, "rem", args)?)
313203
},
314204
);
@@ -318,7 +208,6 @@ impl UserData for LuaReflectReference {
318208
let self_: ReflectReference = self_.into();
319209
let target_type_id = self_.tail_type_id(world.clone())?.or_fake_id();
320210
let args = vec![ScriptValue::Reference(self_)];
321-
// Ok(try_call_overloads(lua, "neg", target_type_id, args, world)?)
322211
Ok(try_call_overloads(world, target_type_id, "neg", args)?)
323212
});
324213

@@ -330,7 +219,6 @@ impl UserData for LuaReflectReference {
330219
let other: ScriptValue = other.into();
331220
let target_type_id = self_.tail_type_id(world.clone())?.or_fake_id();
332221
let args = vec![ScriptValue::Reference(self_), other];
333-
// Ok(try_call_overloads(lua, "pow", target_type_id, args, world)?)
334222
Ok(try_call_overloads(world, target_type_id, "pow", args)?)
335223
},
336224
);
@@ -343,7 +231,6 @@ impl UserData for LuaReflectReference {
343231
let other: ScriptValue = other.into();
344232
let target_type_id = self_.tail_type_id(world.clone())?.or_fake_id();
345233
let args = vec![ScriptValue::Reference(self_), other];
346-
// Ok(try_call_overloads(lua, "eq", target_type_id, args, world)?)
347234
Ok(try_call_overloads(world, target_type_id, "eq", args)?)
348235
},
349236
);
@@ -356,7 +243,6 @@ impl UserData for LuaReflectReference {
356243
let other: ScriptValue = other.into();
357244
let target_type_id = self_.tail_type_id(world.clone())?.or_fake_id();
358245
let args = vec![ScriptValue::Reference(self_), other];
359-
// Ok(try_call_overloads(lua, "lt", target_type_id, args, world)?)
360246
Ok(try_call_overloads(world, target_type_id, "lt", args)?)
361247
},
362248
);
@@ -411,17 +297,6 @@ impl UserData for LuaReflectReference {
411297
LUA_CALLER_CONTEXT,
412298
)?;
413299
Ok(LuaScriptValue(out))
414-
// let mut display_func =
415-
// lookup_dynamic_function_typed::<ReflectReference>(lua, "display_ref")
416-
// .expect("No 'display' function registered for a ReflectReference");
417-
418-
// let out = display_func.call_script_function(
419-
// vec![ScriptValue::Reference(self_)],
420-
// world,
421-
// lua_caller_context(Some(std::any::TypeId::of::<ReflectReference>())),
422-
// )?;
423-
424-
// Ok(LuaScriptValue::from(out))
425300
});
426301
}
427302
}

0 commit comments

Comments
 (0)