Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Lua 

Include lua from external source in lua?

How can i include lua from a external source, in my already existing lua document?

Basically include lua from a domain, inside the existing lua?
Depends. Are you trying to do this in GMod or in straight up Lua? And do you have the ability to use the socket library?
If you are using GLua, something along the lines http.Get and RunString/RunStringEx.
If your want it to work outside of GLua, use the socket library to download to a string and then execute it with standard lua functions. A bit more code but it's not very hard. Look at the socket library wiki for downloading to a string and the lua PIL book for how to execute a string.
Code
http.Fetch("url", function(body) RunString(body) end, function() end)

That should work (assuming this is for GLua).
It's for a Playstation 3 Game. It's not Garry's mod, but the lua is similar.

It's currently limit size, i mean i can't make the file huger than 1MB. So if i load it from a external website, i can have the size huge as i want.

@ dumblr, i'll try it and let you know of it works out. Hopefully it does!

( I can post a snippet of my lua code later, then you can see how it's coded.. I can basically replace everything it )
(Jun 22, 2013 03:41 AM)'An0ny Wrote:  It's for a Playstation 3 Game. It's not Garry's mod, but the lua is similar.

It's currently limit size, i mean i can't make the file huger than 1MB. So if i load it from a external website, i can have the size huge as i want.

@ dumblr, i'll try it and let you know of it works out. Hopefully it does!

( I can post a snippet of my lua code later, then you can see how it's coded.. I can basically replace everything it )

What game is it? The syntax for Garry's Mod is bound to be different but I can do some research and try and make it work for the PS3 game.
(Jun 22, 2013 04:59 AM)Mumford and Sons Wrote:  What game is it? The syntax for Garry's Mod is bound to be different but I can do some research and try and make it work for the PS3 game.

It's a game called "Playstation Home". There are no guide or documents for it, but i can do whatever i want with it.

I just have to load the functions, then add some lines.. I'll show you a snippet when i have access to my computer again.

Do you have skype? I'm very bad at lua modding and you could earn some cash helping me out.. Skype: Team_Enigma . Cheers :D
http://www.ps3hax.net/2010/12/homebrew-a...luaplayer/
Code
local socket = require('socket'); -- or w/e your lua sockets module is called

-- Get the text from url by sending a GET request

assert( loadstring( result ) );

Might work.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Lua] by Toph BeifongMay 7, 2025 07:19 PM 13 658 May 7, 2025 07:19 PM
Last Post: Phantom_NiNja
[Help] by Fusion_eliteSep 23, 2016 12:18 PM 0 89 Sep 23, 2016 12:18 PM
Last Post: Fusion_elite
[Lua] by EthorbitDec 19, 2015 12:48 PM 7 482 Dec 19, 2015 12:48 PM
Last Post: Im Friendly