Can you precache animations like you do with sounds, and how much can you transfer from C# to Glua?

Tl;dr: Title.

In Depth Explanation:
So I was wandering how, if at all posible, you can precache animations, like you can do with sounds?
An example could be:


precachedSound = Sound( sound_name.wav )

Now, if I wanted to do the same thing, say with a player enumeration, how should I do?

My other question is a bit difficult to explain, but I will do my best.
I’ve been working with C#, and was wondering if there are any syntax you can transfer to Glua, wether slightly altered or not?
For example in C# I can write:



variable = condition ? resultIfConditionIsTrue : resultIfConditionIsFalse;


instead of writing:



if (condition) then{variable = resultIfConditionIsTrue;}else{variable = resultIfConditionIsFalse;}end}


Sorry for my english and coding, I am in a bit of a hurry.

I’m not sure about precaching animations but for your C# to Lua ternary question, yes lua has a kind of weird ternary system.



local var = condition and conditionIfTrue or conditionIfFalse

-- Shorthand alternative
local var = condition or conditionIfFalse -- This will set var to condition if true or conditionIfFalse otherwise.


I wouldn’t say Lua and C# are similar enough to ‘transfer’ the syntax, but I’d say that all the basic programming needs from C# still exist in lua.

Also be sure to skim throug the Programming in Lua Book to learn some basics.

You don’t recache animations.

[editline]26th March 2015[/editline]

Animations are stored in a model. You can precache models.

Thank you very much, both of you! :slight_smile: