Powered by Invision Power Board

 
  Pages: (14) « First ... 9 10 [11] 12 13 ... Last » ( Go to first unread post ) Reply to this topicStart new topicStart Poll

> XLua, MMF2 Extension
United States
Retriever II
Posted: Aug 7 2009, 02:45 PM
Quote Post


Catalyst
[H][*][*][*][*]
[*][*][*][*][*]


Group Icon
Group: Members
Posts: 18290
Member No.: 52
Joined: 13-October 03

Status: (0d) [--]


_G is the global table. It's like any other table in Lua but it has all the global functions/variables/etc.


--------------------

PMEmail PosterUsers WebsiteICQAOLMSN
Top
Denmark
Mecha the Slag
Posted: Aug 7 2009, 02:55 PM
Quote Post


http://mechaware.net
[*][*][*][*][*]
[*][*][*]

Group Icon
Group: Members
Posts: 11816
Member No.: 728
Joined: 15-December 04

Status: (0d) [--]


can't really seem to get anything out of it, I tried

for index, value in ipairs(_G) do print(value) end

and it didn't print anything. Any ideas that might help me?


--------------------




MechaWare GamesMechaSourceMechaWare for CellphonesMechaWare on Steam

PMUsers WebsiteMSN
Top
United States
Retriever II
Posted: Aug 7 2009, 03:13 PM
Quote Post


Catalyst
[H][*][*][*][*]
[*][*][*][*][*]


Group Icon
Group: Members
Posts: 18290
Member No.: 52
Joined: 13-October 03

Status: (0d) [--]


QUOTE (Mecha the Slag @ Aug 7 2009, 03:55 PM)
can't really seem to get anything out of it, I tried

for index, value in ipairs(_G) do print(value) end

and it didn't print anything. Any ideas that might help me?

You have to use pairs, not ipairs. ipairs will only enumerate consecutive integer indices.

for index, value in pairs(_G) do print(index, value) end

This post has been edited by Retriever II on Aug 7 2009, 03:13 PM


--------------------

PMEmail PosterUsers WebsiteICQAOLMSN
Top
Denmark
Mecha the Slag
Posted: Aug 7 2009, 03:15 PM
Quote Post


http://mechaware.net
[*][*][*][*][*]
[*][*][*]

Group Icon
Group: Members
Posts: 11816
Member No.: 728
Joined: 15-December 04

Status: (0d) [--]


Thank you. But is there any way to retrieve the name of the function? It only returns id.

This post has been edited by Mecha the Slag on Aug 7 2009, 03:15 PM


--------------------




MechaWare GamesMechaSourceMechaWare for CellphonesMechaWare on Steam

PMUsers WebsiteMSN
Top
United States
Retriever II
Posted: Aug 7 2009, 03:17 PM
Quote Post


Catalyst
[H][*][*][*][*]
[*][*][*][*][*]


Group Icon
Group: Members
Posts: 18290
Member No.: 52
Joined: 13-October 03

Status: (0d) [--]


QUOTE (Mecha the Slag @ Aug 7 2009, 04:15 PM)
Thank you. But is there any way to retrieve the name of the function? It only returns id.

Run the code I posted, it prints index (name) and value


--------------------

PMEmail PosterUsers WebsiteICQAOLMSN
Top
Denmark
Mecha the Slag
Posted: Aug 7 2009, 03:48 PM
Quote Post


http://mechaware.net
[*][*][*][*][*]
[*][*][*]

Group Icon
Group: Members
Posts: 11816
Member No.: 728
Joined: 15-December 04

Status: (0d) [--]


CODE
function foo(bar) print(bar) end

foo("test")
-> test

for index, value in pairs(_G) do print(index, value) end
-> string table: 01F8EC80
-> DoCall function: 01F8E320
-> package table: 01F8E910


I don't see any foo ):


--------------------




MechaWare GamesMechaSourceMechaWare for CellphonesMechaWare on Steam

PMUsers WebsiteMSN
Top
United States
Retriever II
Posted: Aug 7 2009, 04:11 PM
Quote Post


Catalyst
[H][*][*][*][*]
[*][*][*][*][*]


Group Icon
Group: Members
Posts: 18290
Member No.: 52
Joined: 13-October 03

Status: (0d) [--]


QUOTE (Mecha the Slag @ Aug 7 2009, 04:48 PM)
I don't see any foo ):

CODE
function foo(bar) print(bar) end

foo("test")

for index, value in pairs(_G) do print(index, value) end


QUOTE
test

string
DoCall
package
tostring
_VERSION Lua 5.1
os
unpack
require
getfenv
x_requirelib
setmetatable
next
assert
tonumber
io
rawequal
collectgarbage
jit
getmetatable
module
rawset
foo
bit
debug
math
table
pcall
coroutine
print
type
xpcall


--------------------

PMEmail PosterUsers WebsiteICQAOLMSN
Top
Denmark
Mecha the Slag
Posted: Aug 7 2009, 04:13 PM
Quote Post


http://mechaware.net
[*][*][*][*][*]
[*][*][*]

Group Icon
Group: Members
Posts: 11816
Member No.: 728
Joined: 15-December 04

Status: (0d) [--]


thats... not what I'm getting at all. Can you send me the mfa you're using?


--------------------




MechaWare GamesMechaSourceMechaWare for CellphonesMechaWare on Steam

PMUsers WebsiteMSN
Top
United States
Retriever II
Posted: Aug 7 2009, 04:14 PM
Quote Post


Catalyst
[H][*][*][*][*]
[*][*][*][*][*]


Group Icon
Group: Members
Posts: 18290
Member No.: 52
Joined: 13-October 03

Status: (0d) [--]




--------------------

PMEmail PosterUsers WebsiteICQAOLMSN
Top
Denmark
Mecha the Slag
Posted: Aug 7 2009, 04:18 PM
Quote Post


http://mechaware.net
[*][*][*][*][*]
[*][*][*]

Group Icon
Group: Members
Posts: 11816
Member No.: 728
Joined: 15-December 04

Status: (0d) [--]


Oh... I forgot to turn on the vertical scrollbar

cheers


--------------------




MechaWare GamesMechaSourceMechaWare for CellphonesMechaWare on Steam

PMUsers WebsiteMSN
Top
United States
Retriever II
Posted: Aug 7 2009, 07:59 PM
Quote Post


Catalyst
[H][*][*][*][*]
[*][*][*][*][*]


Group Icon
Group: Members
Posts: 18290
Member No.: 52
Joined: 13-October 03

Status: (0d) [--]


I figured out your problem.

Notice how the error is referencing DoCall instead of the actual registered function. Every registered function is translated like so:

CODE
function myfunc (a, b, c)
 -- parameter error checking....
 DoCall("myfunc", a, b, c)
end


So when you have a triggered error on parameter a, even though it's at index 1, it's actually at index 2 of DoCall.

What actually is triggering your error in the first place is trying to pass a function or a table as a parameter. Mystery dispelled!

Obviously this situation could use some improvement.

Also CALLOUT TO XGOFF: You mentioned a couple pages back about the lua demo giving better error feedback than XLua. Do you have a concrete example of what it's returning that you like?


--------------------

PMEmail PosterUsers WebsiteICQAOLMSN
Top
Denmark
Mecha the Slag
Posted: Aug 8 2009, 02:24 AM
Quote Post


http://mechaware.net
[*][*][*][*][*]
[*][*][*]

Group Icon
Group: Members
Posts: 11816
Member No.: 728
Joined: 15-December 04

Status: (0d) [--]


alright cheers

Would it be possible to add a "on new function registered"? Don't really need to know anything on the new function, I just need to know when I need to update my list of functions.

This post has been edited by Mecha the Slag on Aug 8 2009, 02:28 AM


--------------------




MechaWare GamesMechaSourceMechaWare for CellphonesMechaWare on Steam

PMUsers WebsiteMSN
Top
United States
Retriever II
Posted: Aug 8 2009, 02:42 AM
Quote Post


Catalyst
[H][*][*][*][*]
[*][*][*][*][*]


Group Icon
Group: Members
Posts: 18290
Member No.: 52
Joined: 13-October 03

Status: (0d) [--]


Sounds reasonable. There's already an OnExport callback so why not.

Also I'm doing some overhauling of error reporting for the next release. At minimum, all MMF-triggered errors should now list the event number where the error was trapped.


--------------------

PMEmail PosterUsers WebsiteICQAOLMSN
Top
Denmark
Mecha the Slag
Posted: Aug 8 2009, 04:19 PM
Quote Post


http://mechaware.net
[*][*][*][*][*]
[*][*][*]

Group Icon
Group: Members
Posts: 11816
Member No.: 728
Joined: 15-December 04

Status: (0d) [--]


would it be possible to have a 'silence mode' of sort, which runs like normal, but all normally MMF registered functions are ignored. This will allow me to run my lua scripts without having to have the million of mmf registered functions I have, yet still be able to get returned errors.

So running the script like normal, without the side effect of it actually doing anything

edit: also sorry if I missed it but, does two xlua objects in same frame work?

This post has been edited by Mecha the Slag on Aug 8 2009, 04:32 PM


--------------------




MechaWare GamesMechaSourceMechaWare for CellphonesMechaWare on Steam

PMUsers WebsiteMSN
Top
United States
Retriever II
Posted: Aug 8 2009, 06:41 PM
Quote Post


Catalyst
[H][*][*][*][*]
[*][*][*][*][*]


Group Icon
Group: Members
Posts: 18290
Member No.: 52
Joined: 13-October 03

Status: (0d) [--]


QUOTE (Mecha the Slag @ Aug 8 2009, 05:19 PM)
would it be possible to have a 'silence mode' of sort, which runs like normal, but all normally MMF registered functions are ignored. This will allow me to run my lua scripts without having to have the million of mmf registered functions I have, yet still be able to get returned errors.

So running the script like normal, without the side effect of it actually doing anything

edit: also sorry if I missed it but, does two xlua objects in same frame work?

I'm really not sure what you're getting at with silent mode.

Yes, you can use 2 XLua objects. You can bind them to separate states, or you can even bind them to the same state although that doesn't really do anything for you.

Something I do plan on adding shortly is a way for states to communicate with each other (basically one state allows certain functions or tables to be accessed by another state). This way you could use a second state to effectively sandbox user scripts, exposing only your API and hiding all the MMF/WIN/io/registered functions/etc that your own scripts depend on. Such a solution presents a little more overhead however.


--------------------

PMEmail PosterUsers WebsiteICQAOLMSN
Top
Denmark
Mecha the Slag
Posted: Aug 8 2009, 07:11 PM
Quote Post


http://mechaware.net
[*][*][*][*][*]
[*][*][*]

Group Icon
Group: Members
Posts: 11816
Member No.: 728
Joined: 15-December 04

Status: (0d) [--]


say I have a normal script with 2 registered mmf functions

in normal mode, xlua would call the "on functions" inside mmf2
if the functions aren't registered it'll produce an error

in silenced mode, xlua won't call the "on functions" inside mmf2
if the functions aren't registered it'll ignore it


--------------------




MechaWare GamesMechaSourceMechaWare for CellphonesMechaWare on Steam

PMUsers WebsiteMSN
Top
United States
Retriever II
Posted: Aug 8 2009, 09:02 PM
Quote Post


Catalyst
[H][*][*][*][*]
[*][*][*][*][*]


Group Icon
Group: Members
Posts: 18290
Member No.: 52
Joined: 13-October 03

Status: (0d) [--]


There's not really any way to avoid generating an error when you call an invalid symbol (e.g. your unregistered function).

What are you ultimately trying to achieve.


--------------------

PMEmail PosterUsers WebsiteICQAOLMSN
Top
Denmark
Mecha the Slag
Posted: Aug 9 2009, 03:20 AM
Quote Post


http://mechaware.net
[*][*][*][*][*]
[*][*][*]

Group Icon
Group: Members
Posts: 11816
Member No.: 728
Joined: 15-December 04

Status: (0d) [--]


checking for errors


--------------------




MechaWare GamesMechaSourceMechaWare for CellphonesMechaWare on Steam

PMUsers WebsiteMSN
Top
United States
Xgoff
Posted: Aug 9 2009, 11:00 PM
Quote Post


<):|
[*][*][*][*][*]
[*][*]

Group Icon
Group: Members
Posts: 52341
Member No.: 24
Joined: 13-October 03

Status: (0d) [--]


QUOTE (Retriever II @ Aug 7 2009, 06:59 PM)
Also CALLOUT TO XGOFF: You mentioned a couple pages back about the lua demo giving better error feedback than XLua.  Do you have a concrete example of what it's returning that you like?

well like any sort of syntax error

something like t = {1, 2, 3, 4 5, 6, 7} throws "input:1: '}' expected near '5'" in lua.exe but xlua just says "syntax error"

though that's an understated example it's quite annoying to get that in a 2000-line script, because notepad++ and probably other editors won't notice those types of syntax errors unlike missing brackets or 'end's... though i guess it's better than lua+'s behavior ie crashing

then there's stuff like the tracebacks:

CODE
a = function ()
  return nil
end
b = function ()
  return a() > 7
end
c = function ()
  return b() < 5
end

print(c() >= 0)


QUOTE
f:\a.txt:5: attempt to compare number with nil
stack traceback:
f:\a.txt:5: in function b()
f:\a.txt:8: in function c()
f:\a.txt:11: in main chunk
[C]: ?


i'd imagine there would be an option in xlua to enable/disable tracebacks because they'd probably get annoying sometimes

This post has been edited by Xgoff on Aug 9 2009, 11:11 PM


--------------------

This post may contain original research or unverified claims.
Please disregard the above information and contact an administrator.

DISCLAIMER: by sending me (xgoff) a private message, you agree to the directives and their terms specified henceforth:
DIRECTIVE 1 (APPLE): i may or may not reply promptly or at all; and there are no guarantees to the usefulness of the reply. i may not acknowledge whether i have even received your private message
DIRECTIVE 2 (CHILE CON CARNE): as per my view, "private" applies only to the initial transaction, and the material of your message may or may not be made public at my discretion; as this will more than likely be a post in the CCC or IRC, you may not be able to view it
DIRECTIVE 3 (FEATHER DUSTER): you must address me (xgoff) as "Sir Master Xgofficus his Highest and Most Awesome the Third"; failure to comply with this term may invoke one or both of the above directives, and i will leave a burning bag of **** on your doorstep
DIRECTIVE 4 (BOOTSTRAP): if you have read this disclaimer, please private message me promptly, in compliance with the above terms, so i can ensure you are capable of following directions you idiot
this concludes the test of the emergency disclaimer system, your scheduled programming will now continue. satisfaction guaranteed, and 100% cash back available under certain circumstances; restrictions may or may not apply within your place of residence
NOTICE: these directives and their terms may change at any time, without notice; as a private message transaction to myself assumes an understanding and full compliance of the above, you should ensure you are fully aware of the above terms at any point before sending a private message; any message received is assumed to have been sent in compliance with the above

QUOTE
(5:25:58 PM) Mikau: xgoff
(5:26:00 PM) Mikau: guess what
(5:26:04 PM) Xgoff: chicken butt
(5:26:09 PM) Mikau: **** you
PMEmail PosterUsers WebsiteAOLMSN
Top
United States
Xgoff
Posted: Aug 12 2009, 12:45 PM
Quote Post


<):|
[*][*][*][*][*]
[*][*]

Group Icon
Group: Members
Posts: 52341
Member No.: 24
Joined: 13-October 03

Status: (0d) [--]


also how do you take advantage of states being global across frames

binding a second xlua (in a subapp frame) to state 0 (the one i'm using) doesn't seem to work


--------------------

This post may contain original research or unverified claims.
Please disregard the above information and contact an administrator.

DISCLAIMER: by sending me (xgoff) a private message, you agree to the directives and their terms specified henceforth:
DIRECTIVE 1 (APPLE): i may or may not reply promptly or at all; and there are no guarantees to the usefulness of the reply. i may not acknowledge whether i have even received your private message
DIRECTIVE 2 (CHILE CON CARNE): as per my view, "private" applies only to the initial transaction, and the material of your message may or may not be made public at my discretion; as this will more than likely be a post in the CCC or IRC, you may not be able to view it
DIRECTIVE 3 (FEATHER DUSTER): you must address me (xgoff) as "Sir Master Xgofficus his Highest and Most Awesome the Third"; failure to comply with this term may invoke one or both of the above directives, and i will leave a burning bag of **** on your doorstep
DIRECTIVE 4 (BOOTSTRAP): if you have read this disclaimer, please private message me promptly, in compliance with the above terms, so i can ensure you are capable of following directions you idiot
this concludes the test of the emergency disclaimer system, your scheduled programming will now continue. satisfaction guaranteed, and 100% cash back available under certain circumstances; restrictions may or may not apply within your place of residence
NOTICE: these directives and their terms may change at any time, without notice; as a private message transaction to myself assumes an understanding and full compliance of the above, you should ensure you are fully aware of the above terms at any point before sending a private message; any message received is assumed to have been sent in compliance with the above

QUOTE
(5:25:58 PM) Mikau: xgoff
(5:26:00 PM) Mikau: guess what
(5:26:04 PM) Xgoff: chicken butt
(5:26:09 PM) Mikau: **** you
PMEmail PosterUsers WebsiteAOLMSN
Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

  Topic Options Topic Options Pages: (14) « First ... 9 10 [11] 12 13 ... Last » Reply to this topicStart new topicStart Poll

 




[ Script Execution time: 0.1131 ]   [ 13 queries used ]   [ GZIP Enabled ]   [ Server Load: 0.59 ]