Jump to content

Question

Posted
gg.setRanges(bit32.bor(gg.REGION_JAVA_HEAP, gg.REGION_C_HEAP, gg.REGION_C_ALLOC, gg.REGION_C_DATA, gg.REGION_C_BSS, gg.REGION_PPSSPP, gg.REGION_ANONYMOUS)) 
Antii = gg.multiChoice({',❌Back❌', '💥PinBall💥'}, nil, '🎖New AntiBounce🎖') 
   
   if Antii == nil then os.exit() else
   
   if Antii == 1 then goto START else
   
   
   if Antii[2] == true then AntiOn() else
   
    function AntiOn() 
   gg.setRanges(gg.REGION_C_ALLOC) 
   gg.searchNumber('526;526;526', gg.TYPE_DWORD, false,gg.SIGN_EQUAL, 0,-1) 
   gg.getResults(100)
   gg.editAll('0', gg.TYPE_DWORD) 
   gg.clearResults()
   end

   
   end
   end
   end

 

IT SHOWS THIS ERROR HOW TO FIX? 

 

@/storage/emulated/0/Download/🔥GGTools🔥[⚡GrowHaxx⚡] [⚡V1⚡].lua:288

`   if Antii[2] == true then AntiOn() else`
attempt to call nil
level = 1, pc = 883
stack traceback:
    /storage/emulated/0/Download/🔥GGTools🔥[⚡GrowHaxx⚡] [⚡V1⚡].lua:288 in main chunk
    [Java]: in ?
    at luaj.LuaValue.checkmetatag(LuaValue.java:2779)
    at luaj.LuaValue.callmt(LuaValue.java:1961)
    at luaj.LuaValue.call(LuaValue.java:1388)
    at luaj.LuaValue.callNotNull(LuaValue.java:3117)
    at luaj.LuaClosure.execute(LuaClosure.java:456)
    at luaj.LuaClosure.call(LuaClosure.java:145)
    at android.ext.Script.runScript(Script.java:5600)
    at android.ext.Script$ScriptThread.run(Script.java:5370)

14 answers to this question

Recommended Posts

  • 0
  • Administrators
Posted
1 hour ago, Ajajhsjwjajaja said:

`   if Antii[2] == true then AntiOn() else`
attempt to call nil

AntiOn is nil at this line.

Function must be defined before call it.

  • 0
  • Administrators
Posted
2 hours ago, Ajajhsjwjajaja said:

function AntiOn() gg.setRanges(gg.REGION_C_ALLOC) gg.searchNumber('526;526;526', gg.TYPE_DWORD, false,gg.SIGN_EQUAL, 0,-1) gg.getResults(100) gg.editAll('0', gg.TYPE_DWORD) gg.clearResults() end

It is called function definition. It is appear after your line.

  • 0
Posted (edited)
12 hours ago, Ajajhsjwjajaja said:

How do i do when i check 2 choices it does both

You need to handle the result returned by "multiChoice" function properly.

According to the function documentation, returned value is either nil (in case of dialog being cancelled), or a table in which selected keys contain value "true". Therefore, proper handling may look like this:

local choices = gg.multiChoice({'Option 1', 'Option 2'})

if choices == nil then
  -- action if dialog has been cancelled
else
  if choices[1] then
    -- action if first option has been selected
  end
  if choices[2] then
    -- action if first option has been selected
  end
end

However, there may be tricky cases where one action prevents other action(s) from being executed. One of such cases is "goto" statement. Once it is executed, all other conditions won't be checked and therefore no actions will be executed. Consider the following example: 

local choices = gg.multiChoice({'Option 1', 'Option 2'})

if choices == nil then
  os.exit()
else
  if choices[1] then
    print('Option 1')
    goto finish
  end
  if choices[2] then
    print('Option 2')
  end
end

::finish::

Here, if user selects both option 1 and option 2, only actions related to option 1 will be executed, because after executing "goto" statement script execution continues from the specified label, "finish" in this case.

Possible workaround here is to check the condition that represents option 1 being selected after all other conditions, so that other conditions will be checked first and related actions will or won't be executed depending on the result of each check. But this workaround can't be applied to the cases where there are "goto" statements in 2 or more blocks of actions related to different conditions. So don't use "goto" and there will be no need to deal with such problems. Use functions instead. There are quite little amount of cases where usage of "goto" is justified and your case is not one of them.

Edited by CmP
Corrected the examples as pointed out below
  • 0
  • Administrators
Posted

Your examples is same. You use "elseif". So only one branch executed. "goto" is useless.

Topicstarter need use separate "if", not "elseif" construction.

 

[added 2 minutes later]
12 hours ago, Ajajhsjwjajaja said:

Oki thanks. How do i do when i check 2 choices it does both

You too lazy for read docs?

scr_1564703033.png

What is that?

 

  • 0
Posted
7 minutes ago, Enyby said:

Your examples is same. You use "elseif". So only one branch executed. "goto" is useless.

Topicstarter need use separate "if", not "elseif" construction.

Yes, thanks for notice, I have corrected the examples.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • 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.