Quantcast

Jump to content

» «
Photo

[LUA] Simpler calls to functions in Alice Lua

5 replies to this topic
Sporbie
  • Sporbie

    Player Hater

  • Members
  • Joined: 08 Aug 2008

#1

Posted 23 December 2008 - 07:18 PM

I've made a big file with Lua functions so you can do this:
CODE
HURR_HURR(param1,paramx)


Instead of this:
CODE
PushInt(param1)
PushInt(paramx)
CallNative("HURR_HURR")


The functions even return an integer if there is one to return.

All functions won't work since there are probably some float arguments somewhere, but most should work.
I know there's probably a simpler way of doing this but this should be good enough for now for people that just got into scripting and don't want to mess with that PushInt() crap.

To use this in your script you have to load it in with with some function (tell me what, I don't know how to include files in Lua) or just copy it on top of your script (it will be very messy I know)

Tell me how it works for you.

http://www.speedysha.../550956566.html

illdan
  • illdan

    Amazingly stupid

  • Members
  • Joined: 13 Dec 2008

#2

Posted 23 December 2008 - 07:31 PM

can u give an example?

Sporbie
  • Sporbie

    Player Hater

  • Members
  • Joined: 08 Aug 2008

#3

Posted 23 December 2008 - 07:46 PM

Well I kinda did but ok here's a real example:

CODE

--the usual way of doing it:
PushInt(PLAYER_INDEX)
PushInt(1)
CallNative("SET_PLAYER_INVINCIBLE")

--With my file:
SET_PLAYER_INVINCIBLE (PLAYER_INDEX, 1)

HazardX
  • HazardX

    pedestrian mangler

  • Members
  • Joined: 13 Dec 2008

#4

Posted 23 December 2008 - 11:12 PM

nice. happy.gif now all we have to find out is how to use includes.

usually those are the ways to use includes in lua:

CODE
include("include/native.lua")

-- and in function
SET_PLAYER_INVINCIBLE (PLAYER_INDEX, 1)


OR

CODE
native=include("include/native.lua")

-- and in function
native.SET_PLAYER_INVINCIBLE (PLAYER_INDEX, 1)


Both don't work. confused.gif

Sporbie
  • Sporbie

    Player Hater

  • Members
  • Joined: 08 Aug 2008

#5

Posted 24 December 2008 - 11:40 AM

QUOTE (HazardX @ Dec 23 2008, 23:12)
nice. happy.gif now all we have to find out is how to use includes.

usually those are the ways to use includes in lua:

CODE
include("include/native.lua")

-- and in function
SET_PLAYER_INVINCIBLE (PLAYER_INDEX, 1)


OR

CODE
native=include("include/native.lua")

-- and in function
native.SET_PLAYER_INVINCIBLE (PLAYER_INDEX, 1)


Both don't work. confused.gif

There's no record of the include() function in the official Lua manual, which means that the maker of GTA IV Lua would have to implement an include on his own.

Intosia
  • Intosia

    I'm random! ^^

  • Members
  • Joined: 11 Dec 2008

#6

Posted 24 December 2008 - 12:13 PM

I think this is LUA's way to do it:
http://www.lua.org/m...html#pdf-module

With modules... Didnt test it.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users