Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Chat / how can i get function address ?

Author
Message
SkinK4ir3
3
Years of Service
User Offline
Joined: 25th Aug 2015
Location:
Posted: 5th Apr 2018 03:44
hi everyone !

how can i get a function address on AppGameKit 2 ?
fubarpk
AGK Developer
Gold Codemaster
13
Years of Service
User Offline
Joined: 11th Jan 2005
Location: Adelaide
Posted: 10th Jun 2018 14:00
Why do you need the function address ?

A function you can pass variables and it will return a value ie sum(num1,num2)
and if you pass variables by reference you can modify several variables in the function
fubar
xCept
15
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 10th Jun 2018 19:54 Edited at: 10th Jun 2018 19:54
Do you mean get the device's IP address? You can use the HTTPRequest commands and point to "https://api.ipify.org" which will return the active IP address that you can then parse in AGK. Here is a copy-paste code sample:
ShaunRW
10
Years of Service
User Offline
Joined: 7th Jan 2008
Location: Victoria, Australia
Posted: 10th Jun 2018 20:41
Do you mean function pointers? AppGameKit doesn't support this AFAIK.
puzzler2018
1
Years of Service
User Offline
Joined: 8th Oct 2017
Location:
Posted: 10th Jun 2018 20:58
maybe

agk:function help()
agk: print("Hello World")
agk:endfunction


and now using C to call a function

agk:help()

Maybe

Cybermind
15
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Searching for The Dark Tower, I hope it is in Denmark, near
Posted: 11th Jun 2018 08:57
Not to be pedantic puzzler2018 but I think you're missing some :
13/0
PSY
Valued Member
2
Years of Service
User Offline
Joined: 3rd Jul 2016
Location: Laniakea Supercluster
Posted: 11th Jun 2018 13:07
Obtaining the address of a function is currently not possible in Tier 1 as far as I know


PSY LABS Games
Coders don't die, they just gosub without return
Jambo B
9
Years of Service
User Offline
Joined: 17th Sep 2009
Location: The Pit
Posted: 11th Jun 2018 20:39
Quote: "Obtaining the address of a function is currently not possible in Tier 1 as far as I know"


That's quite right. And if you had it, what would you do with it?

PartTimeCoder
AGK Tool Maker
3
Years of Service
User Offline
Joined: 9th Mar 2015
Location: Londinium
Posted: 16th Jun 2018 14:54
Quote: "That's quite right. And if you had it, what would you do with it?"


pass it to a library function to define a callback

the biggest drawback of the AppGameKit plugin system is the lack communication between the plugin and tier1, it would be great if plugin code could call tier1 functions and access array data like in Lua/CLua, this would need pointers, or at least some kind of stack system

Kevin Picone
16
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 16th Jun 2018 19:50

Quote: "pass it to a library function to define a callback"


That's not really going to work, as the pointer would be the location of the function within in the AGK byte code, rather than native code. So the callback would need to run the AppGameKit VM to execute the request. I can think ways around such things but that's for another day

PlayBASIC To HTML5/WEB - Convert PlayBASIC To Machine Code
PartTimeCoder
AGK Tool Maker
3
Years of Service
User Offline
Joined: 9th Mar 2015
Location: Londinium
Posted: 16th Jun 2018 22:03
I have work-a-rounds in place already that's how I got AppGameKit embedded inside a PureBasic built UI exported as a plugin, I know it would not really work but the question was asked: "And if you had it, what would you do with it?", I merely gave an example, I know its never going to happen.

now AGKSharp is out I wonder if TGC would also endorse a C++ built Lua implementation like Love2D, I would gladly write the code.
Markus
Valued Member
14
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 18th Jun 2018 14:50
if you look for a call by name for scripting maybe u can use a select case name where you call the function.

AGK (Steam) V2017.12.12 : Windows 10 Pro 64 Bit : NVIDIA (390.65) GeForce GTX 1050 Ti : Mac mini OS High Sierra (10.13)

Login to post a reply

Server time is: 2018-10-16 20:15:04
Your offset time is: 2018-10-16 20:15:04