adamix Posted December 27, 2009 Share Posted December 27, 2009 Objective: To realize the object on the server with which you can call functions of the client. Example: client = Client.new (clientElem); client.setGarageOpen (1, true); and the object on the client, with which you can call the server functions. Example: server.createPed (1, 1024, 1024, 1024); Waiting for your ideas and examples. Sorry for my english. Link to comment
robhol Posted December 27, 2009 Share Posted December 27, 2009 I've fantasized a bit about an OOP-oriented form of scripting as well. I think it would be neat. Of course, implementing another language (which you'd almost certainly have to do, to get "real OOP") is a hell of a lot of work. Link to comment
DakiLLa Posted December 27, 2009 Share Posted December 27, 2009 i remember that somebody already tryed to make something like oop-style with lua but failed, i think.. agree that it will take an ages to make a new full-power and full working oop "language".. this one and this Link to comment
adamix Posted December 27, 2009 Author Share Posted December 27, 2009 I think it is quite possible to implement. I looked at the script rule of arc_, there is implemented such a system only for calling the server functions for client. It is possible to adapt it to calling client functions from server. Link to comment
robhol Posted December 27, 2009 Share Posted December 27, 2009 Well, Lua is adequate, but if I could script for MTA in, say, C#, I could die happy. Squirrel doesn't look half-bad either. Link to comment
eAi Posted December 27, 2009 Share Posted December 27, 2009 It's an intentional part of mta's design that the client can't do too much that will affect other players. Directly exposing server side functions to clients opens things up for cheaters even more. Remember it's not practical really to have server functions being called from the client and returning values due to the latency. Link to comment
robhol Posted December 27, 2009 Share Posted December 27, 2009 It's starting to dawn on me I might've slightly misunderstood the point of this topic. Link to comment
eAi Posted December 28, 2009 Share Posted December 28, 2009 I'm not sure that making client and server objects is the most useful way an OO interface for MTA could be made. If you wanted to make that kind of interface, I believe it'd be fairly easy with metatables. Link to comment
DutchCaffeine Posted December 28, 2009 Share Posted December 28, 2009 i remember that somebody already tryed to make something like oop-style with lua but failed, i think.. agree that it will take an ages to make a new full-power and full working oop "language"..this one and this And i'm that one, and yes it is not yet finished. But still im working on it. But im to busy with other stuff. Link to comment
50p Posted December 28, 2009 Share Posted December 28, 2009 I'm not sure that making client and server objects is the most useful way an OO interface for MTA could be made.If you wanted to make that kind of interface, I believe it'd be fairly easy with metatables. It would be easy with metatables but there are main 2 situations where you don't want to use OOP. 1. Calling timers fails, if calling a method from an instance of a class. local a = Class:new(); setTimer( a:method, 100, 1 ); -- this doesn't work setTimer( Class.method, 100, 1, a ); -- AFAIR, this fails too 2. You can't really export classes from resource and that makes no use of OOP in Lua for MTA. MTA has new calling exported functions system (accessing exported functions from "exports" table). exports.myresource:Class:new(); -- Class is a table(class) not exported function and that's why it fails It would be nice. Even though, I use OOP as often as I can since this is good to get used to. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now