Jon Kleiser | 1 Dec 2000 10:16
Picon
Picon
Favicon
Gravatar

Why not semicolon after "function()" ?

Why is
    f = function() print(9);end
accepted, while
    f = function();print(9);end
is not?

/Jon
---------------------------------------------------------------------------
Jon Kleiser / ADB ekstern / USIT / University of Oslo / Norway
Mail: Jon.Kleiser <at> usit.uio.no / Tel: +47-22 85 28 04 / Fax: +47-22 85 29 70
---------------------------------------------------------------------------

Picon

Re: Why not semicolon after "function()" ?

>Why is
>    f = function() print(9);end
>accepted, while
>    f = function();print(9);end
>is not?

Because Lua does not have an empty statement.
Semicolons can only appear after statements.
--lhf

Daniel Krenn | 2 Dec 2000 15:09
Favicon

Game Scripting Problem

Hi,

We're new to scripting and are strongly considering using LUA with one
of our upcoming projects. Since our knowledge of scripting in general
is rather limited, we were wondering if someone might be able to offer
us some assistance with the following problem.

If we are wanting to implement simple script functionality such as...

----------------------------
Spawn("Location 1")

do
  GotoLocation("Location 2")
  Wait(2)
  GotoLocation("Location 1")
  Wait(2)
end
----------------------------

...whereby multiple actors can be using a script similar to (but much
more complex than) this example. The actors need to process each line
of the script sequentially, and not continue to the next line of script
until the current line (command) has been successfully completed (obviously
=p)

What would be the best way to have the script operate in this fashion
(while at the same time trying to avoid multi-threading, and
coroutines) ???

(Continue reading)

paul | 3 Dec 2000 08:03

Re: Game Scripting Problem

You may want to adopt an event-driven style, and use a timer to trigger
the process of every steps in a event so that you can maintain all
activities of different events in a single thread.

In your Lua script, the GotoLocation("Location 2") actually only
triggers the initiation of a 'Goto' event. If you want subsequent
actions to be taken after GotoLocation("Location 2"), you may pass
them as function callbacks.

Regards,
.paul.

On Sun, Dec 03, 2000 at 12:09:33AM +1000, Daniel Krenn wrote:
> Hi,
> 
> We're new to scripting and are strongly considering using LUA with one
> of our upcoming projects. Since our knowledge of scripting in general
> is rather limited, we were wondering if someone might be able to offer
> us some assistance with the following problem.
> 
> If we are wanting to implement simple script functionality such as...
> 
> ----------------------------
> Spawn("Location 1")
> 
> do
>   GotoLocation("Location 2")
>   Wait(2)
>   GotoLocation("Location 1")
>   Wait(2)
(Continue reading)

sessile | 3 Dec 2000 16:22

Lua-4.0 project files for MS VC++ 6.0?

Would any kind soul who has built Lua-4.0 on Windoze using
VC++ 6.0 please point me toward the necessary project files?

I need to switch from gcc/mingw due to incompatibilities
with a third-party (no source available but I know it was
made using VC++) library that I am trying to access from
Lua.

Thanks.

--
E-Mail:  sessile <at> in-gen.net
  "I don't want the world... I just want your half."
                   -- TMBG (Anna Ng)

Diego Nehab | 3 Dec 2000 22:54
Picon

Re: Luasock & LuaSocket

>  I am looking for a Lua 3.1 extension for sockets that runs on
> Windows. The Luasock seems to be for UNIX and LuaSocket for Lua 3.2
> (or Lua 4.0).

Hi, the file http://www.tecgraf.puc-rio.br/~diego/luasocket/old.zip
contains an old version of luasocket which was created for Lua 3.2 NG, a
modified Lua 3.2 that was already thread safe. Just take the files and
modify them to remove the leading lua_State variable from the Lua API
calls. I believe this is the only thing that has to be changed from 3.2
NG back to 3.1. Please someone correct me if I am wrong.

Cheers,
Diego Nehab.

John Belmonte | 4 Dec 2000 06:02
Picon
Favicon

Re: global scope revisited

Roberto wrote:
> To say that the backward compatibility is "suspect" is a bit strong, but
> I have some questions about it (questions, not suspicions ;-) Could you
> explain how would you achieve this compatibility? (Remember that, although
> the global events are a subset of the table events, they are not selected
> in the same way. You have only one pair of settable/gettable handlers for
> a given global table, but you may have different setglobal/getglobal
> handlers for different global values.)

I've attached the backward compatibility tag methods (mostly just copied
from the Lua manual) along with a simple test.

I don't quite understand the issue you mentioned.  If you can think of some
reasonable code where the compatibility would fail please show it to me.

For the compatibility, get/settagmethod should handle registering and
retrieval of get/setglobal events just as they do now (although those events
should be deprecated).  It's just that accessing the global scope will not
trigger them, and instead will trigger the table events (settable, gettable,
index).

-John

Attachment (global-tm-emu.lua): application/octet-stream, 2275 bytes
Charlie Goff | 4 Dec 2000 10:33
Picon
Favicon

Linking Dependencies, State Persistence

Two Questions/Problems:

	1.  Creating the Standard Library (lauxlib.c lbaselib.c ldblib.c liolib.c
lmathlib.c lstrlib.c) as a DLL under MSVC 6 causes a linking errors "*.obj :
error LNK2001: unresolved external symbol _lua_*" where "*" varies.
Searching all files for "_lua_" returns no results.  I'm assuming that
because I am making a DLL that the pre-appending "_" is done by MSVC.
	Which would mean that the Standard Library depends on the Core Library,
right?  If so, why isn't this stated in \Install?

	2.  Has any one figured out how to serialize an entire Lua State from
C/C++?  I've seen a lot of examples on how to save (only) variables to disk,
but I need to save functions too.

Thanks Everyone,
Charlie Goff (chagbinary <at> email.com)

/* MFC has taken over your project. Your code is now bloated. Your code is
now unportable.  And you will never make it past CWinApp.  Please do not
contact Microsoft Support.  We are busy creating new buggy and bloated
things to f$%k with your head. */

Vincent Penquerc'h | 4 Dec 2000 11:19
Favicon

RE: Game Scripting Problem

> ----------------------------
> Spawn("Location 1")
> 
> do
>   GotoLocation("Location 2")
>   Wait(2)
>   GotoLocation("Location 1")
>   Wait(2)
> end
> ----------------------------

As an example, here is how I handle the goto commands:
When I need to go to a particular location, I call a game
routine "FindPathTo", which returns a userdata (a path).
I then call "FollowPath" for the character. This will set
the path as the 'current' path. Every game tick, if the
character has a current path, it progresses through it.
When it reaches the end of the path, the current path is
reset to nothing.
If I want to be notified whenever the character reaches its
target, I set a scope on the location where to go. A scope
is a location or a set of locations which, upon being entered
or left by a character, send a message to the scope creator.
This allows to be notified whenever arriving to destination,
but other things to: a merchant can know whenever someone
enters or leaves its store, etc, etc.
Having a pause instruction in your script will require you
to modify Lua or to have complex housekeeping in your engine.

--

-- 
(Continue reading)

Daniel Krenn | 4 Dec 2000 11:27
Favicon

Re: Linking Dependencies, State Persistence

I have VC6 projects set up for a static version of the libs if you're
interested. I haven't bothered with DLL's at the moment.

CG> Two Questions/Problems:

CG>         1.  Creating the Standard Library (lauxlib.c lbaselib.c ldblib.c liolib.c
CG> lmathlib.c lstrlib.c) as a DLL under MSVC 6 causes a linking errors "*.obj :
CG> error LNK2001: unresolved external symbol _lua_*" where "*" varies.
CG> Searching all files for "_lua_" returns no results.  I'm assuming that
CG> because I am making a DLL that the pre-appending "_" is done by MSVC.
CG>         Which would mean that the Standard Library depends on the Core Library,
CG> right?  If so, why isn't this stated in \Install?

CG>         2.  Has any one figured out how to serialize an entire Lua State from
CG> C/C++?  I've seen a lot of examples on how to save (only) variables to disk,
CG> but I need to save functions too.

CG> Thanks Everyone,
CG> Charlie Goff (chagbinary <at> email.com)

CG> /* MFC has taken over your project. Your code is now bloated. Your code is
CG> now unportable.  And you will never make it past CWinApp.  Please do not
CG> contact Microsoft Support.  We are busy creating new buggy and bloated
CG> things to f$%k with your head. */


Gmane