Jump to content

How to call another lua file from one lua file (import extra gg code)


Crystal_Mods100x

Recommended Posts

Posted

Hi its crystal mods back with another tutorial.

i will show you how to call a lua script with one lua script i have been using this ever since to add extra features or just add imports but its files not actually importing in the text editor.

1. Make 2 files one can be your main script the other will be your script you will be calling from your main script 😄

Main Script: (file name: Main.lua) (warning: menu doesn't have to be a local variable but  i just do that you don't have to make it local!

function exec(thisPath)
  doFile(thisPath) --using dofile the script will try to execute the other script :D
end

local menu = gg.choice({"Call File","Exit"},nil,"Main Script")
if menu == 1 then
  exec("/storage/emulated/0/Download/Import.lua") --We pass the file path in which the import file is located.
end
if menu == 2 then
os.exit(gg.toast("Script Killed"))
end

 

Now we code our import script 😄

 

Import Script: (name: Import.lua)

--import code
gg.sleep(300)
gg.toast("x")
gg.sleep(300)
gg.toast("xx")
gg.sleep(300)
gg.toast("*****")
gg.sleep(300)
gg.toast("xxxx")
gg.sleep(300)
gg.toast("xxxxx")
gg.sleep(300)
gg.toast("Script Loaded")
gg.alert("I have been imported")
dofile("/storage/emulated/0/Download/Main.lua") --We call back to the main script because the import script has finished its operation

You can use this for hiding stuff, or whatever you would like 😉 Hey Enyby think you can get around the import feature? i have been using this for months now and no one has gotten my values or ranges ever since with this import i write my scripts the weirdest as they can. 

Give me your opinions guys 😄 i want to know what you think about this feature??  alright im out! (neck hurts :P)

Posted
3 hours ago, Crystal_Mods100x said:

1. Make 2 files one can be your main script the other will be your script you will be calling from your main script

hmm i think i will go straight to second file.

Posted

I'll download your two lua.main and call file.I can directly run your second lua. You should set a connection between two file. to avoid running only one file by user.

If the search is long enough, i can also check what you are you looking for.

  • 8 months later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.