3B00DG4MER Posted February 23, 2015 Posted February 23, 2015 Hi guys, I tried to Export an OOP function like that: function dxEditBox:create() end <export function="dxEditBox:create" type="client" /> i Called it like that : exports.RESOURCENAME:dxEditBox:create() SAF/SAO - 30% Skype: Themerzoug2020 in-game name:3B00DG4MER
TAPL Posted February 24, 2015 Posted February 24, 2015 https://forum.multitheftauto.com/viewtopic.php?f=91&t=85392 https://bugs.multitheftauto.com/view.php?id=8774
3B00DG4MER Posted February 24, 2015 Author Posted February 24, 2015 so I've to define it as variable first ? SAF/SAO - 30% Skype: Themerzoug2020 in-game name:3B00DG4MER
JR10 Posted February 24, 2015 Posted February 24, 2015 That's one possible solution, it's annoying but makes it possible. That topic has everything you need. Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
3B00DG4MER Posted February 24, 2015 Author Posted February 24, 2015 Thank You, SAF/SAO - 30% Skype: Themerzoug2020 in-game name:3B00DG4MER
3B00DG4MER Posted February 24, 2015 Author Posted February 24, 2015 local menu = exports[ "SAFMenu" ].Menu_create( localPlayer, bot:getData("name"),155,0, 0 ) loadstring(exports[ "SAFMenu" ].Menu_open( localPlayer,absoluteX, absoluteY ))(menu) failed to call 'SAFMenu:Menu_open' [string "?"] Bad Argument 1 [Expected String got Boolean] attempt to call a boolean SAF/SAO - 30% Skype: Themerzoug2020 in-game name:3B00DG4MER
JR10 Posted February 24, 2015 Posted February 24, 2015 Why are you using loadstring? loadstring is used to run code, you're passing the returned value of Menu_open to loadstring. Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
3B00DG4MER Posted February 24, 2015 Author Posted February 24, 2015 if i don't use loadstring, same problem SAF/SAO - 30% Skype: Themerzoug2020 in-game name:3B00DG4MER
JR10 Posted February 24, 2015 Posted February 24, 2015 Did you export the open function with the correct type? Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
3B00DG4MER Posted February 24, 2015 Author Posted February 24, 2015 Menu = {} Menu.__index = Menu Menu.instances = {} Menu_open = Menu.open function Menu:open(x, y) ... return self end <export function="Menu_open" type="client" /> SAF/SAO - 30% Skype: Themerzoug2020 in-game name:3B00DG4MER
JR10 Posted February 24, 2015 Posted February 24, 2015 You assign Menu_open before you define Menu.open? Move the line below the function. Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
3B00DG4MER Posted February 24, 2015 Author Posted February 24, 2015 same SAF/SAO - 30% Skype: Themerzoug2020 in-game name:3B00DG4MER
3B00DG4MER Posted February 24, 2015 Author Posted February 24, 2015 Do you want me to send you the Resource on PM ? SAF/SAO - 30% Skype: Themerzoug2020 in-game name:3B00DG4MER
Addlibs Posted February 24, 2015 Posted February 24, 2015 local menu = exports[ "SAFMenu" ].Menu_create( localPlayer, bot:getData("name"),155,0, 0 ) As far as I know, exports is a table, but exports["SAFMenu"] is more like a class... I think you were meant to put a semi-colon ( : ) instead of the period ( . ) between exports["SAFMenu"] and Menu_create Previously known as MrTasty.
3B00DG4MER Posted February 24, 2015 Author Posted February 24, 2015 i think they're the same ? SAF/SAO - 30% Skype: Themerzoug2020 in-game name:3B00DG4MER
JR10 Posted February 24, 2015 Posted February 24, 2015 Not really. Just replace the dot with a semi-colon. local menu = exports[ "SAFMenu" ]:Menu_create( localPlayer, bot:getData("name"),155,0, 0 ) exports[ "SAFMenu" ]:Menu_open( localPlayer,absoluteX, absoluteY ) Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
3B00DG4MER Posted February 24, 2015 Author Posted February 24, 2015 (edited) Menus = {} Menus.main = exports[ "SAFMenu" ]:Menu_create("Test",155,0, 0 ) That Line Works That one is killing ME ! exports[ "SAFMenu" ]:Menu_open(Menus.main,absoluteX, absoluteY ) Failed to call:"SAFMenu:Menu_open" [string: ?] Edited February 24, 2015 by Guest SAF/SAO - 30% Skype: Themerzoug2020 in-game name:3B00DG4MER
JR10 Posted February 24, 2015 Posted February 24, 2015 Did you even read the replies in the topic TAPL linked you to? Meta tables are resource specific not global. If you don't understand then it's time to learn more about OOP or just drop it and use procedural syntax. Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
3B00DG4MER Posted February 24, 2015 Author Posted February 24, 2015 i can't , i made more than 40 OOP function in One resource SAF/SAO - 30% Skype: Themerzoug2020 in-game name:3B00DG4MER
JR10 Posted February 24, 2015 Posted February 24, 2015 Well, you can't export OOP functions right now, a bug is reported (again, TAPL's links) so you just have to wait or try something different. The topic covered a possible work around, check it. Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
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